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

Add dialogs plugin #157

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions completion/bash/m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ _m_sub () {
bluetooth)
subcommands=(status on enable off disable help)
;;
dialogs)
subcommands=(autoexpand)
;;
dir)
subcommands=(tree size delete help)
;;
Expand Down
3 changes: 3 additions & 0 deletions completion/fish/m.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 5 additions & 0 deletions completion/zsh/_m
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@ function _m_cmd {
"disable:turn off bluetooth" \
help
;;
dialogs)
_m_solo \
$sub \
"autoexpand:Whether dialogs auto-expand"
;;
dir)
_m_dir
;;
Expand Down
46 changes: 46 additions & 0 deletions plugins/dialogs
Original file line number Diff line number Diff line change
@@ -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