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

Aliases? #281

Open
danielbayley opened this issue Jun 12, 2020 · 6 comments
Open

Aliases? #281

danielbayley opened this issue Jun 12, 2020 · 6 comments

Comments

@danielbayley
Copy link
Contributor

danielbayley commented Jun 12, 2020

Is your feature request related to a problem? Please describe.
mas could use a few aliases, to bring it more in line with brew and cask

Describe the solution you'd like
These could include:

  • mas -v/--version -> mas version
  • mas -h/--help -> mas help
  • mas ls -> mas list
  • mas i -> mas install
  • mas rm -> mas uninstall
  • mas update -> brew upgrade mas
@phatblat
Copy link
Member

Good idea! These would be easy to add.

@danielbayley
Copy link
Contributor Author

These would be easy to add.

@phatblat I imagine so… although I haven't dug into Swift yet… If you point out where in the codebase, I can do a PR…

@phatblat
Copy link
Member

phatblat commented Jun 14, 2020

This project uses Commandant and all the commands live in the Commands folder. I don't see an option in Commandant for creating a command alias. However, you could:

  1. Duplicate the classes
  2. Add the new command class to the registry main.swift

danielbayley added a commit to danielbayley/mas that referenced this issue Jun 16, 2020
Add `i` alias for `install` command. See mas-cli#281.
danielbayley added a commit to danielbayley/mas that referenced this issue Jun 16, 2020
Add `ls` alias for `list` command. See mas-cli#281.
danielbayley added a commit to danielbayley/mas that referenced this issue Jun 16, 2020
Add `remove` alias for `uninstall` command. See mas-cli#281.
danielbayley added a commit to danielbayley/mas that referenced this issue Jun 16, 2020
Add `rm` alias for `uninstall` command. See mas-cli#281.
@danielbayley
Copy link
Contributor Author

danielbayley commented Jun 16, 2020

This project uses Commandant and all the commands live in the Commands folder. I don't see an option in Commandant for creating a command alias. However, you could:

  1. Duplicate the classes

  2. Add the new command class to the registry main.swift

@phatblat Ok, quickly done that for i, ls, rm/remove, and a rough implementation of update in #283… Not sure how to deal with -v/--version, or -h/--help within the context of the Commandant framework though?

danielbayley added a commit to danielbayley/mas that referenced this issue Jun 16, 2020
Add `update` alias for `brew upgrade mas`. See mas-cli#281.
@muescha
Copy link

muescha commented Jun 18, 2022

the -v/--version, or -h/--help are flags and options in the Commandant system

@muescha
Copy link

muescha commented Jun 20, 2022

just copy over the command looks not good as coding style - i would create a wrapper command for alias and wrap them in this command - so no duplicate code is created

see comment here: Carthage/Commandant#155 (comment)

if the alias command not goes into commandant - we can add it anyway into the mas codebase

Note: duplicate code is bad, because if someone change the code most time they forget to edit the "copied" code part)

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

No branches or pull requests

3 participants