Feature request: Add `$ trellis cd SITE`
- [x] I've read the guidelines for Contributing to Roots Projects
- [x] This request isn't a duplicate of an existing request
- [x] This is not a personal support request that should be posted on the Roots Discourse community
Summary
Add $ trellis cd SITE which $ cd into bedrock (maybe sage as well) directory.
Motivation
So nobody needs to remember local_path
Additional context
cd-ing into Bedrock is easy. However, Trellis has no place for sage directory names (unless a better version of https://github.com/roots/trellis/pull/1030 arrives). Thus, Sage might have to wait.
This is suggested by @Log1x
Is $ trellis cd SITE literal? Meaning you'd type in SITE? (or site) If Sage were supported you'd type trellis cd theme or something?
I mean the site key. Example:
-
$ trellis cd example.comcd into example.com'slocal_path -
$ trellis cd example.com --sagecd into example.com's sage directory
🤦♂ of course sorry. Could it be more generic?
-
$ trellis cd example.com -
$ trellis cd example.com theme
And if you only have a single site:
-
$ trellis cd site -
$ trellis cd theme
Maybe just "site" could be treated "magically" 🤔
How about environments?
Example: For the same project, I use valet and my colleagues use vagrant. So, we have 2 local environments.
Also leads to the question - Do we vagrant ssh and cd inside the VM?
cd seems like it should be a local development command only to me but I don't really know how you'd deal with valet vs vagrant. Does it matter if all the command does is cd locally on the host to the local_path?
That's a great idea. That would be nice to also list all the websites that were added before and also given them an alias. So instead of writing the whole site name, we could call them by the alias.
Example: $ trellis site list
alias | name site1 | this-is-a-very-long-url-for-a-website.com site2 | another-example.com site3 | one-more.com
or maybe we could select the website from a list using the component promptui if we type: $ trellis cd Select a site -> this-is-a-very-long-url-for-a-website.com another-example.com one-more.com
Was thinking about this again when I realized that isn't possible to do this the way we want. Processes like trellis can't change the directory of the parent process that spawned it. So we can of course change the working directory within the process that spawns when you run trellis but when the process exits it won't persist.
The only real alternative is to have a command that outputs the path so people can do cd $(trellis path example.com). I don't think that's useful or intuitive enough to justify it's existence so I'm going to close this.