diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 0dfc190..a9071f1 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -1,8 +1,7 @@ | |||
1 | use clap::{Parser, Subcommand}; | 1 | use clap::{Parser, Subcommand, CommandFactory}; |
2 | use modlist::{config::Cfg, mod_add, mod_remove, db::{lists_get, config_get_current_list, lists_get_all_ids}, IDSelector, download, update, List, get_current_list, import, devdir, export, list_add, Modloader, list_version, list_remove, list_change}; | 2 | use modlist::{config::Cfg, mod_add, mod_remove, db::{lists_get, config_get_current_list, lists_get_all_ids}, IDSelector, download, update, List, get_current_list, import, devdir, export, list_add, Modloader, list_version, list_remove, list_change}; |
3 | 3 | ||
4 | //TODO make default list optional | 4 | //TODO make default list optional |
5 | |||
6 | #[derive(Parser)] | 5 | #[derive(Parser)] |
7 | #[command(author, version, about)] | 6 | #[command(author, version, about)] |
8 | struct Cli { | 7 | struct Cli { |
@@ -61,6 +60,9 @@ enum Commands { | |||
61 | Export { | 60 | Export { |
62 | /// the list you want to export | 61 | /// the list you want to export |
63 | list: Option<String> | 62 | list: Option<String> |
63 | }, | ||
64 | Completions { | ||
65 | shell: clap_complete::Shell, | ||
64 | } | 66 | } |
65 | } | 67 | } |
66 | 68 | ||
@@ -233,5 +235,9 @@ async fn main() { | |||
233 | Commands::Export { list } => { | 235 | Commands::Export { list } => { |
234 | export(config, list) | 236 | export(config, list) |
235 | }, | 237 | }, |
238 | Commands::Completions { shell } => { | ||
239 | clap_complete::generate(shell, &mut Cli::command(), "modlist", &mut std::io::stdout()); | ||
240 | Ok(()) | ||
241 | } | ||
236 | }.unwrap(); | 242 | }.unwrap(); |
237 | } | 243 | } |