@@ -5,13 +5,13 @@ use std::{
5
5
} ;
6
6
7
7
use cargo_metadata:: Message ;
8
- use clap:: { Args , Parser , Subcommand } ;
8
+ use clap:: { Args , CommandFactory , Parser , Subcommand } ;
9
9
use espflash:: {
10
10
cli:: {
11
- self , board_info, config:: Config , connect, erase_partitions, flash_elf_image,
11
+ self , board_info, completions , config:: Config , connect, erase_partitions, flash_elf_image,
12
12
monitor:: monitor, parse_partition_table, partition_table, print_board_info,
13
- save_elf_as_image, serial_monitor, ConnectArgs , EspflashProgress , FlashConfigArgs ,
14
- MonitorArgs , PartitionTableArgs ,
13
+ save_elf_as_image, serial_monitor, CompletionsArgs , ConnectArgs , EspflashProgress ,
14
+ FlashConfigArgs , MonitorArgs , PartitionTableArgs ,
15
15
} ,
16
16
image_format:: ImageFormatKind ,
17
17
logging:: initialize_logger,
@@ -32,7 +32,7 @@ mod error;
32
32
mod package_metadata;
33
33
34
34
#[ derive( Debug , Parser ) ]
35
- #[ clap( version, bin_name = "cargo" , propagate_version = true ) ]
35
+ #[ clap( version, propagate_version = true ) ]
36
36
struct Cli {
37
37
#[ clap( subcommand) ]
38
38
subcommand : CargoSubcommand ,
@@ -50,6 +50,7 @@ enum CargoSubcommand {
50
50
#[ derive( Debug , Subcommand ) ]
51
51
enum Commands {
52
52
BoardInfo ( ConnectArgs ) ,
53
+ Completions ( CompletionsArgs ) ,
53
54
Flash ( FlashArgs ) ,
54
55
Monitor ( MonitorArgs ) ,
55
56
PartitionTable ( PartitionTableArgs ) ,
@@ -137,6 +138,7 @@ fn main() -> Result<()> {
137
138
// associated arguments.
138
139
match args {
139
140
Commands :: BoardInfo ( args) => board_info ( & args, & config) ,
141
+ Commands :: Completions ( args) => completions ( & args, & mut Cli :: command ( ) , "cargo" ) ,
140
142
Commands :: Flash ( args) => flash ( args, & config) ,
141
143
Commands :: Monitor ( args) => serial_monitor ( args, & config) ,
142
144
Commands :: PartitionTable ( args) => partition_table ( args) ,
0 commit comments