Skip to content

Commit 5cb07bd

Browse files
ddelemenyfmassot
andauthored
Build CLI without clap's load_yaml. Fixes #880 (#1133)
* Build CLI without clap's load_yaml. See #880 * Formatting * Require arg in top-level cli invocation * Remove cli.yaml Co-authored-by: François Massot <[email protected]>
1 parent d3db9bd commit 5cb07bd

File tree

11 files changed

+317
-566
lines changed

11 files changed

+317
-566
lines changed

Cargo.lock

Lines changed: 4 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quickwit-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ path = "src/generate_markdown.rs"
2222
async-trait = "0.1"
2323
anyhow = "1"
2424
byte-unit = { version = "4", default-features = false, features = ["serde"] }
25-
clap = { version = "=3.0.0-beta.5", features = ["yaml"] }
25+
clap = { version = "=3.0.14", features = ["yaml", "env"] }
2626
quickwit-actors = { version = "0.2.0", path = "../quickwit-actors" }
2727
quickwit-core = { version = "0.2.0", path = "../quickwit-core" }
2828
quickwit-directories = { version = "0.2.0", path = "../quickwit-directories" }

quickwit-cli/src/cli.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,23 @@
1818
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1919

2020
use anyhow::bail;
21-
use clap::ArgMatches;
21+
use clap::{App, AppSettings, ArgMatches};
2222
use tracing::Level;
2323

24-
use crate::index::IndexCliCommand;
25-
use crate::service::ServiceCliCommand;
26-
use crate::source::SourceCliCommand;
27-
use crate::split::SplitCliCommand;
24+
use crate::index::{build_index_command, IndexCliCommand};
25+
use crate::service::{build_service_command, ServiceCliCommand};
26+
use crate::source::{build_source_command, SourceCliCommand};
27+
use crate::split::{build_split_command, SplitCliCommand};
28+
29+
pub fn build_cli<'a>() -> App<'a> {
30+
App::new("Quickwit")
31+
.subcommand(build_source_command())
32+
.subcommand(build_service_command())
33+
.subcommand(build_split_command())
34+
.subcommand(build_index_command())
35+
.setting(AppSettings::DisableHelpSubcommand)
36+
.setting(AppSettings::ArgRequiredElseHelp)
37+
}
2838

2939
#[derive(Debug, PartialEq)]
3040
pub enum CliCommand {

0 commit comments

Comments
 (0)