[Question] Commands in different files #1977
Answered
by
denisidoro
denisidoro
asked this question in
Q&A
-
Is there a way to define each command in a different file when using Structopt-like syntax? For example, in here I'd like to define |
Beta Was this translation helpful? Give feedback.
Answered by
denisidoro
Jun 23, 2020
Replies: 2 comments 1 reply
-
#[derive(Clap)]
enum Subcommands {
Query(QuerySubcommand),
Search(SearchSubcommand),
}
// in query.rs
#[derive(Clap)]
struct QuerySubcommand { ... }
// in search.rs
#[derive(Clap)]
struct SearchSubcommand { ... } |
Beta Was this translation helpful? Give feedback.
0 replies
-
Is there a way to prevent writing |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
CreepySkeleton
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to prevent writing
Query
in the initial file altogether? Maybe using traits?