File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ struct Cli {
2323enum Subcommand {
2424 /// Load a preset configuration.
2525 Load {
26- /// Name of the preset to load. Must correspond to a file in the `presets/` directory without the `.toml` extension.
26+ /// Name of the preset to load. Can either be a path, or the name of a file in the `presets/` directory without the `.toml` extension.
2727 preset : String ,
2828 /// Do not ask for confirmation.
2929 #[ arg( long, default_value_t = false ) ]
@@ -79,8 +79,14 @@ fn ask_confirmation(prompt: &str) -> bool {
7979}
8080
8181fn run_load_preset ( preset_name : & str , no_confirm : bool , current_dir : & Path ) -> Result < ( ) , Error > {
82- // Load the preset file from the `presets/` directory.
83- let preset_path = PathBuf :: from ( "presets" ) . join ( format ! ( "{preset_name}.toml" ) ) ;
82+ // Load the file, or get it from the `presets/` directory
83+ let pb = PathBuf :: from ( preset_name) ;
84+ let preset_path = if pb. is_file ( ) {
85+ pb
86+ } else {
87+ PathBuf :: from ( "presets" ) . join ( format ! ( "{preset_name}.toml" ) )
88+ } ;
89+
8490 let preset = config:: load_toml ( & preset_path) ?;
8591
8692 let config_path = current_dir. join ( "config.toml" ) ;
You can’t perform that action at this time.
0 commit comments