Skip to content

Command Arguments

Ben Chatelain edited this page Jan 31, 2019 · 1 revision

This project uses the Commandant framework to parse arguments and it also generates the help command output. You can use mas help <command> to see the options for any command.

$ mas help install
Install from the Mac App Store

(integer)
	app ID(s) to install

--force
	force reinstall

$ mas help uninstall
Uninstall app installed from the Mac App Store

(integer)
	ID of app to uninstall

--dry-run
	dry run

I'd love to see a script to auto-generate the shell completion files by parsing the help command output, but that should probably be in a separate PR.

Each command (in MasKit/Commands/) has a type conforming to OptionsProtocol (usually at the end of the file) which is where arguments and flags are declared.

  • NoOptions is pretty obvious.
  • Argument declares positional arguments
  • Switch is for boolean flags where key is the --long form and flag is the short -l form (if non-nil)
  • Option is a --named argument
Clone this wiki locally