Enum handlr_regex::cli::Cmd
source · pub enum Cmd {
List {
all: bool,
},
Open {
paths: Vec<UserPath>,
},
Set {
mime: MimeOrExtension,
handler: Handler,
},
Unset {
mime: MimeOrExtension,
},
Launch {
mime: MimeOrExtension,
args: Vec<UserPath>,
},
Get {
json: bool,
mime: MimeOrExtension,
},
Add {
mime: MimeOrExtension,
handler: Handler,
},
Mime {
json: bool,
paths: Vec<UserPath>,
},
Autocomplete {
desktop_files: bool,
mimes: bool,
},
}Expand description
A better xdg-utils
Resource opener with support for wildcards, multiple handlers, and regular expressions.
Based on handlr at https://github.com/chmln/handlr
Regular expression handlers inspired by mimeo at https://xyne.dev/projects/mimeo/
Variants§
List
List default apps and the associated handlers
Output is formatted as a table with two columns. The left column shows mimetypes and the right column shows the handlers
Currently does not support regex handlers.
Open
Open a path/URL with its default handler
Unlike xdg-open and similar resource openers, multiple paths/URLs may be supplied.
If multiple handlers are set and enable_selector is set to true,
you will be prompted to select one using selector from ~/.config/handlr/handlr.toml.
Otherwise, the default handler will be opened.
Set
Fields
mime: MimeOrExtensionMimetype or file extension to operate on.
Set the default handler for mime/extension
Overwrites currently set handler(s) for the given mime/extension.
Asterisks can be used as wildcards to set multiple mimetypes.
File extensions are converted into their respective mimetypes in mimeapps.list.
Currently does not support regex handlers.
Unset
Fields
mime: MimeOrExtensionMimetype or file extension to unset the default handler of
Unset the default handler for mime/extension
Wildcards cannot be used unless removing handlers that already have wildcards.
If multiple default handlers are set, both will be removed.
Currently does not support regex handlers.
Launch
Fields
mime: MimeOrExtensionMimetype or file extension to launch the handler of
Launch the handler for specified extension/mime with optional arguments
Only supports wildcards for mimetypes for handlers that have been set or added with wildcards.
If multiple handlers are set and enable_selector is set to true,
you will be prompted to select one using selector from ~/.config/handlr/handlr.toml.
Otherwise, the default handler will be opened.
Get
Get handler for this mime/extension
If multiple handlers are set and enable_selector is set to true,
you will be prompted to select one using selector from ~/.config/handlr/handlr.toml.
Otherwise, only the default handler will be printed.
Note that regex handlers are not supported by this subcommand currently.
When using --json, output is in the form:
{
"handler": "helix.desktop",
"name": "Helix",
"cmd": "helix"
}
Note that when handlr is not being directly output to a terminal, and the handler is a terminal program,
the “cmd” key in the json output will include the command of the x-scheme-handler/terminal handler.
Add
Fields
mime: MimeOrExtensionMimetype to add handler to
Add a handler for given mime/extension
Note that the first handler is the default.
This subcommand adds secondary handlers that coexist with the default and does not overwrite existing handlers.
Mime
Fields
Get the mimetype of a given file/URL
By default, output is in the form of a table that matches file paths/URLs to their mimetypes.
When using --json, output will be in the form:
[
{
"path": "README.md"
"mime": "text/markdown"
},
{
"path": "https://duckduckgo.com/"
"mime": "x-scheme-handler/https"
}
...
]
Autocomplete
Fields
Helper subcommand for autocompletion scripts; should be hidden
This should not be visible in handlr --help output, autocompletion, or man pages.
If you see this there, please open an issue on Github.
However it is fine if this shows up in the output of handlr autocomplete --help.
Trait Implementations§
source§impl CommandFactory for Cmd
impl CommandFactory for Cmd
source§fn into_app_for_update<'b>() -> Command<'b>
fn into_app_for_update<'b>() -> Command<'b>
CommandFactory::command_for_updatesource§impl FromArgMatches for Cmd
impl FromArgMatches for Cmd
source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches ) -> Result<Self, Error>
source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches ) -> Result<(), Error>
ArgMatches to self.source§fn update_from_arg_matches_mut<'b>(
&mut self,
__clap_arg_matches: &mut ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches ) -> Result<(), Error>
ArgMatches to self.source§impl Parser for Cmd
impl Parser for Cmd
source§fn parse_from<I, T>(itr: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn parse_from<I, T>(itr: I) -> Selfwhere I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
source§fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
source§fn update_from<I, T>(&mut self, itr: I)where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn update_from<I, T>(&mut self, itr: I)where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
source§fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
source§impl Subcommand for Cmd
impl Subcommand for Cmd
source§fn augment_subcommands<'b>(__clap_app: Command<'b>) -> Command<'b>
fn augment_subcommands<'b>(__clap_app: Command<'b>) -> Command<'b>
source§fn augment_subcommands_for_update<'b>(__clap_app: Command<'b>) -> Command<'b>
fn augment_subcommands_for_update<'b>(__clap_app: Command<'b>) -> Command<'b>
source§fn has_subcommand(__clap_name: &str) -> bool
fn has_subcommand(__clap_name: &str) -> bool
Self can parse a specific subcommand