diff --git a/completion/bash/m b/completion/bash/m index 3dbf0ff..421a654 100644 --- a/completion/bash/m +++ b/completion/bash/m @@ -21,6 +21,9 @@ _m_sub () { bluetooth) subcommands=(status on enable off disable help) ;; + dialogs) + subcommands=(autoexpand) + ;; dir) subcommands=(tree size delete help) ;; diff --git a/completion/fish/m.fish b/completion/fish/m.fish index fb421a7..2a6543b 100755 --- a/completion/fish/m.fish +++ b/completion/fish/m.fish @@ -65,6 +65,9 @@ complete -f -c m -n '__fish_m_using_command bluetooth' -a "off" -d 'turn off blu complete -f -c m -n '__fish_m_using_command bluetooth' -a "disable" -d 'turn off bluetooth' complete -f -c m -n '__fish_m_using_command bluetooth' -a "help" -d 'Show help' +complete -f -c m -n '__fish_m_needs_command' -a dialogs -d 'Manage dialogs' +complete -f -c m -n '__fish_m_needs_command dialogs' -a "autoexpand" -d 'Whether print, save and other dialogs auto-expand' + ## XXX: complete -f -c m -n '__fish_m_needs_command' -a dir -d 'Show and delete dir trees' complete -f -c m -n '__fish_m_using_command dir' -a "tree" -d 'tree view of folders in the current or specified path' diff --git a/completion/zsh/_m b/completion/zsh/_m index 70c6bf2..64f32c1 100644 --- a/completion/zsh/_m +++ b/completion/zsh/_m @@ -423,6 +423,11 @@ function _m_cmd { "disable:turn off bluetooth" \ help ;; + dialogs) + _m_solo \ + $sub \ + "autoexpand:Whether dialogs auto-expand" + ;; dir) _m_dir ;; diff --git a/plugins/dialogs b/plugins/dialogs new file mode 100755 index 0000000..ecf3977 --- /dev/null +++ b/plugins/dialogs @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +source "$( dirname "${BASH_SOURCE[0]}" )/../lib/defaults.sh" +source "$( dirname "${BASH_SOURCE[0]}" )/../lib/converters.sh" + +declare command +command="$(basename "$0")" +declare subcommand="$1" + +[ $# -gt 0 ] && shift + +help(){ + cat<<__EOF__ + Usage: + m dialogs autoexpand [ YES | NO ] # Whether print, save and other dialogs auto-expand +__EOF__ +} + +autoexpand(){ + value="$(_mcli_defaults_yes_no_to_boolean "NSGlobalDomain" \ + "NSNavPanelExpandedStateForSaveMode" \ + "$1")" + value="$(_mcli_defaults_yes_no_to_boolean "NSGlobalDomain" \ + "NSNavPanelExpandedStateForSaveMode2" \ + "$1")" + value="$(_mcli_defaults_yes_no_to_boolean "NSGlobalDomain" \ + "PMPrintingExpandedStateForPrint" \ + "$1")" + value="$(_mcli_defaults_yes_no_to_boolean "NSGlobalDomain" \ + "PMPrintingExpandedStateForPrint2" \ + "$1")" + + echo "${command} ${subcommand}: ${value}" +} + +case "${subcommand}" in + help) + help + ;; + autoexpand) + autoexpand "$@" + ;; + *) + help + ;; +esac