Open
Description
Overview
Implement a configuration / config / settings / preferences system.
- A command-line interface must be added to modify & to display settings; see below
- Command-line flags like
--local-only
should be rendered unnecessary - If using flags, though,
--local-only
should be renamed as people might consider USB or Thunderbolt drives to be local- Maybe
--root-applications-folder-only
? Something more concise?
- Maybe
- Command-line flags like
- The configuration must be stored somewhere. Options:
- Environment variables: No
- Much too easy to be set incorrectly or to get messed up by other code / configs
- Config file: Yes
- A
UserDefaults
plist: binary, XML, or JSON? Probably use binary - mas will only run on macOS, so no need to worry about cross-platform issues
- The Swift
UserDefaults
API will facilitate implementation
- A
- Environment variables: No
- Users should be informed of new settings:
- Document them the
mas help
output - Document them the
README.md
- Notify via a new advice/alert/hint/notice/notification/tip system
- Document them the
- Settings would be namespaced via a
.
-delimited hierarchy
Interface
Unless someone suggests a better interface: use mas config
to set settings (it currently does not set settings; it only outputs various info about mas & system).
Will use subcommands instead of options for the various command lines unless someone convinces me otherwise.
- print setting:
print [<setting>…]
:- print given setting values one per line, like
<setting>: <value>
- if no settings specified, print all setting values
- default subcommand, so
mas config [<setting>…]
is equivalent - print only values = quiet?:
-q/--quiet
and/or-v/--value/--value-only
:- print each value without its corresponding setting name, i.e.:
<value>
instead of<setting>: <value>
- print values in the order of the
<setting>
arguments, or alphabetically if no<setting>
s were given
- print each value without its corresponding setting name, i.e.:
- print given setting values one per line, like
- set setting:
set (<setting> <value>)…
:- set each setting to its respective value
- normally accepts literal values but can accept flags that map to values:
- e.g.: for app search folder, accept
--all-root-applications-folders
(equivalent to/Volumes/*/Applications
) - use the standalone
--
option/flag terminator before a literal value that begins with--
- e.g.:
mas config -s setting-name -- --literal-value
- e.g.:
- e.g.: for app search folder, accept
- add to setting:
add (<setting> <value>)…
:- add each value to its respective setting:
- e.g., add a path to the app search folder path list
- add each value to its respective setting:
- print info about setting:
info [<setting>…]
:- prints explanatory text, default value, and possibly current value for each given setting
- if no settings are specified, print info for all settings
- print default setting value:
default [<setting>…]
- print given setting default values one per line, like
<setting>: <value>
- if no settings specified, print all setting default values
- print only values = quiet?:
-q/--quiet
and/or-v/--value/--value-only
:- print each value without its corresponding setting name, i.e.:
<value>
instead of<setting>: <value>
- print values in the order of the
<setting>
arguments, or alphabetically if no<setting>
s were given
- print each value without its corresponding setting name, i.e.:
- print given setting default values one per line, like
- reset setting:
reset [<setting>…]
:- no
<setting>
s: prompt to reset all settings to default (--force
avoids prompt) <setting>
s: reset<setting>
to default value
- no
- remove value from setting:
remove (<setting> <value>)…
:- remove
<value>
from<setting>
list - if all values have been removed, the setting reverts to its default value
- remove
- export setting:
export [<setting>…]
:- print command lines to set each setting to its current value, one setting per command line
- if no settings are specified, print commands for all settings
- if a setting is non-defaulted, print a
set
command line - if a setting is defaulted, print a
reset
command line -c/--concise
: As necessary:- print one
set
command line to set all non-defaulted settings to their current values - print one
reset
command line to reset all defaulted settings
- print one
-l/--literal-defaults
: useset
instead ofreset
for defaulted settings-d/--defaults-only
?: print command lines to set each setting to its current literal default value (to compare different defaults across mas versions)
- excluded settings
excluded
:- print settings that are excluded from being printed by commands without explicit
<setting>
arguments --all
for other commands will include excluded settingsexcluded
would have all the other config subcommands as subcommands (excluded
would obviously not be a subcommand ofexcluded
)- default excluded settings might include dismissed tips, but maybe not the tip-dismissal setting
- print settings that are excluded from being printed by commands without explicit