2019-12-03 18:03:42 +08:00
|
|
|
function __fish_print_xdg_desktop_file_ids --description 'Print all available xdg desktop file IDs'
|
2022-07-22 18:20:45 +08:00
|
|
|
find (__fish_print_xdg_applications_directories) -name \*.desktop \( -type f -or -type l \) -printf '%P\n' | string replace -a -- / - | path sort -u
|
2019-12-03 18:03:42 +08:00
|
|
|
end
|
2012-06-16 08:30:10 +08:00
|
|
|
|
|
|
|
# main completion
|
|
|
|
complete -c xdg-mime -n 'not __fish_seen_subcommand_from query default install uninstall' -xa 'query default install uninstall'
|
|
|
|
|
|
|
|
# complete xdg-mime query
|
|
|
|
complete -c xdg-mime -n '__fish_seen_subcommand_from query; and not __fish_seen_subcommand_from filetype default' -xa 'filetype default' -d 'Query information'
|
|
|
|
|
|
|
|
# complete xdg-mime query default
|
2024-01-22 14:42:45 +08:00
|
|
|
complete -c xdg-mime -d 'Query default application for type' -n 'contains_seq query default -- (commandline -cxp)' -xa '(__fish_print_xdg_mimetypes)'
|
2012-06-16 08:30:10 +08:00
|
|
|
|
|
|
|
# complete xdg-mime query filetype
|
2024-01-22 14:42:45 +08:00
|
|
|
complete -c xdg-mime -d 'Query file\'s filetype' -n 'contains_seq query filetype -- (commandline -cxp)' -r
|
2012-06-16 08:30:10 +08:00
|
|
|
|
|
|
|
# complete xdg-mime default
|
2024-02-15 16:56:09 +08:00
|
|
|
complete -c xdg-mime -d 'Choose application' -n '__fish_seen_subcommand_from default; and test (commandline -xpc|count) -eq 2' -xa '(__fish_print_xdg_desktop_file_ids)'
|
|
|
|
complete -c xdg-mime -d Mimetype -n '__fish_seen_subcommand_from default; and test (commandline -xpc|count) -ge 3' -xa '(__fish_print_xdg_mimetypes)'
|
2012-06-16 08:30:10 +08:00
|
|
|
|
|
|
|
# complete xdg-mime install
|
2024-01-22 14:42:45 +08:00
|
|
|
complete -c xdg-mime -d 'Add filetype description' -n 'contains_seq xdg-mime install -- (commandline -cxp)' -r
|
|
|
|
complete -c xdg-mime -d 'Set mode' -n 'contains_seq xdg-mime install -- (commandline -cxp)' -l mode -xa 'user system'
|
|
|
|
complete -c xdg-mime -d 'Disable vendor check' -n 'contains_seq xdg-mime install -- (commandline -cxp)' -l novendor
|
2012-06-16 08:30:10 +08:00
|
|
|
|
|
|
|
# complete xdg-mime uninstall
|
2024-01-22 14:42:45 +08:00
|
|
|
complete -c xdg-mime -d 'Remove filetype description' -n 'contains_seq xdg-mime uninstall -- (commandline -cxp)' -r
|
|
|
|
complete -c xdg-mime -d 'Set mode' -n 'contains_seq xdg-mime uninstall -- (commandline -cxp)' -l mode -xa 'user system'
|
2012-06-16 08:30:10 +08:00
|
|
|
|
|
|
|
#complete -c xdg-mime install [--mode mode] [--novendor] mimetypes-file
|
|
|
|
#complete -c xdg-mime uninstall [--mode mode] mimetypes-file
|
|
|
|
complete -c xdg-mime -l help -d 'Display help'
|
|
|
|
complete -c xdg-mime -l manual -d 'Diplay long help'
|
|
|
|
complete -c xdg-mime -l version -d 'Print version'
|