-
Notifications
You must be signed in to change notification settings - Fork 288
Open
Labels
Description
Overview
Implement a configuration / config / settings / preferences system.
- https://github.com/apple/swift-configuration
- A command-line interface must be added to modify & to display settings; see below - Command-line flags like
--local-onlyshould be rendered unnecessary- If using flags, though,
--local-onlyshould be renamed as people might consider USB or Thunderbolt drives to be local- Maybe
--root-applications-folder-only? Something more concise?
- Maybe
- If using flags, though,
- 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
UserDefaultsplist: binary, XML, or JSON? Probably use binary - mas will only run on macOS, so no need to worry about cross-platform issues
- The Swift
UserDefaultsAPI will facilitate implementation
- A
- Environment variables: No
- Users should be informed of new settings:
- Document them the
mas helpoutput - 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/--quietand/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/--quietand/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 (--forceavoids 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
setcommand line - if a setting is defaulted, print a
resetcommand line -c/--concise: As necessary:- print one
setcommand line to set all non-defaulted settings to their current values - print one
resetcommand line to reset all defaulted settings
- print one
-l/--literal-defaults: usesetinstead ofresetfor 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 --allfor other commands will include excluded settingsexcludedwould have all the other config subcommands as subcommands (excludedwould 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
Reactions are currently unavailable