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

Can Drush site-alias return the alias names only in v9? #2639

Closed
robballou opened this issue Feb 23, 2017 · 6 comments
Closed

Can Drush site-alias return the alias names only in v9? #2639

robballou opened this issue Feb 23, 2017 · 6 comments

Comments

@robballou
Copy link

In Drush 9, it appears that site-alias will return the alias name plus the configuration of the alias. In cases where I'm trying to find the alias name, I used to do something like: drush sa | grep example. Now that will return a large number of results (potentially) as it returns everything.

As a workaround on Mac, I can do: drush sa | grep "^\S" | grep example but that's more work 😀

Using: Drush version : 9.0-dev-g86760050

@weitzman
Copy link
Member

Not possible right now. You post-process the yaml output (our default format here) with https://github.com/grasmash/yaml-cli

@greg-1-anderson
Copy link
Member

In Drush 8, drush sa --format=list. This is currently broken in Drush 9, but should be fixable.

@olivier-pierre
Copy link

I think this is a regression, because in drush 8.x, or even early 9.x IIRC, drush sa only return aliases name. Is it possible to use list format by default on this comment ? yaml format still be available for verbose and parsable output.

@greg-1-anderson
Copy link
Member

This is a change in behavior, but I would not classify it as a regression. Some behavior will change across major version releases.

In Drush 8, the default format for an alias varied depending on whether you were listing all aliases, or just one. In Drush 9, we removed the ability to have variable default formats for commands, as being unable to predict the output format of a command is bad for scriptability.

Rather than returning list as the default format for drush sa, perhaps it might be reasonable to have a different command that always produces an alias list.

Note also that in Drush 9.0.0-beta9, drush sa @site.dev --format=list will print just the name of just one alias, which might address the problem in the OP.

@olivier-pierre
Copy link

OK, calling it regression is a bit hard ! ;)

I understand your points, and agree with them. I'm ok with this behavior, I just loose my quick use case : "Type 'drush sa' to quickly know what are the aliases in my current docroot".

@greg-1-anderson
Copy link
Member

$ alias sa='drush site:alias --format=list

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

No branches or pull requests

4 participants