rlqt_ui/cli.rs
1// Copyright (C) 2025-2026 Michael S. Klishin and Contributors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use clap::{Arg, Command};
16
17pub fn clap_parser() -> Command {
18 let serve_cmd = Command::new("serve")
19 .about("Start the web server for log querying")
20 .arg(
21 Arg::new("input_db_file_path")
22 .long("input-db-file-path")
23 .short('d')
24 .required(true)
25 .value_name("PATH")
26 .help("Path to the SQLite database file"),
27 )
28 .arg(
29 Arg::new("host")
30 .long("host")
31 .default_value("127.0.0.1")
32 .value_name("HOST")
33 .help("Host address to bind to"),
34 )
35 .arg(
36 Arg::new("port")
37 .long("port")
38 .short('p')
39 .default_value("15692")
40 .value_name("PORT")
41 .help("Port to listen on"),
42 );
43
44 let web_group = Command::new("web")
45 .about("Web UI operations")
46 .subcommand_required(true)
47 .subcommand(serve_cmd);
48
49 Command::new("rlqt-ui")
50 .version(env!("CARGO_PKG_VERSION"))
51 .about("RabbitMQ Log Query Tools - Web UI")
52 .subcommand_required(true)
53 .subcommand(web_group)
54}