Skip to content
Snippets Groups Projects

feat(clap_complete): add completion subcommand

Merged Paco Velobs requested to merge pacovelobs-add-clap_complete-through-subcommand into master
All threads resolved!
Files
5
+ 13
0
@@ -72,6 +72,9 @@ pub enum Subcommand {
@@ -72,6 +72,9 @@ pub enum Subcommand {
/// The custom benchmark subcommmand benchmarking runtime pallets.
/// The custom benchmark subcommmand benchmarking runtime pallets.
#[clap(name = "benchmark", about = "Benchmark runtime pallets.")]
#[clap(name = "benchmark", about = "Benchmark runtime pallets.")]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
 
 
/// Generate completion for various shell interpreters
 
Completion(Completion),
}
}
/// Block authoring scheme to be used by the node
/// Block authoring scheme to be used by the node
@@ -84,6 +87,10 @@ pub enum Sealing {
@@ -84,6 +87,10 @@ pub enum Sealing {
/// Author a block upon receiving an RPC command
/// Author a block upon receiving an RPC command
Manual,
Manual,
/// Author blocks at a regular interval specified in milliseconds
/// Author blocks at a regular interval specified in milliseconds
 
// Clap limitiation with non-unit variant.
 
// While it compiles just fine with clap alone, clap_complete emits a compile-time error.
 
// See https://github.com/clap-rs/clap/issues/3543
 
#[clap(skip)]
Interval(u64),
Interval(u64),
}
}
@@ -110,3 +117,9 @@ impl std::str::FromStr for Sealing {
@@ -110,3 +117,9 @@ impl std::str::FromStr for Sealing {
})
})
}
}
}
}
 
 
#[derive(Debug, clap::Args)]
 
pub struct Completion {
 
#[clap(short, long, arg_enum)]
 
pub generator: clap_complete::Shell,
 
}
Loading