Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add $ trellis cd SITE #92

Closed
3 tasks done
tangrufus opened this issue Jan 4, 2020 · 7 comments
Closed
3 tasks done

Feature request: Add $ trellis cd SITE #92

tangrufus opened this issue Jan 4, 2020 · 7 comments
Labels
good first issue Good for newcomers

Comments

@tangrufus
Copy link
Collaborator

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 roots/trellis#1030 arrives). Thus, Sage might have to wait.

This is suggested by @Log1x

@tangrufus tangrufus changed the title Feature request: Add $ trellis cd Feature request: Add $ trellis cd SITE Jan 4, 2020
@tangrufus tangrufus added the good first issue Good for newcomers label Jan 4, 2020
@swalkinshaw
Copy link
Member

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?

@tangrufus
Copy link
Collaborator Author

tangrufus commented Jan 4, 2020

I mean the site key. Example:

  • $ trellis cd example.com cd into example.com's local_path
  • $ trellis cd example.com --sage cd into example.com's sage directory

@swalkinshaw
Copy link
Member

🤦‍♂ 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" 🤔

@tangrufus
Copy link
Collaborator Author

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?

@swalkinshaw
Copy link
Member

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?

@amelotrgr
Copy link

amelotrgr commented Feb 21, 2020

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

@swalkinshaw
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants