rocketmq_cli/command_line.rs
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17use std::path::PathBuf;
18
19use clap::Parser;
20use clap::Subcommand;
21
22#[derive(Parser, Debug)]
23#[command(author = "mxsm", version = "0.2.0", about = "RocketMQ CLI(Rust)")]
24pub struct RootCli {
25 #[command(subcommand)]
26 pub command: Commands,
27}
28
29#[derive(Debug, Subcommand)]
30pub enum Commands {
31 #[command(
32 arg_required_else_help = true,
33 author = "mxsm",
34 version = "0.2.0",
35 about = "read message log file"
36 )]
37 ReadMessageLog {
38 #[arg(
39 short,
40 long,
41 value_name = "FILE",
42 default_missing_value = "None",
43 help = "message log file path"
44 )]
45 config: Option<PathBuf>,
46
47 #[arg(
48 short = 'f',
49 long,
50 value_name = "FROM",
51 default_missing_value = "None",
52 help = "The number of data started to be read, default to read from the beginning. \
53 start from 0"
54 )]
55 from: Option<u32>,
56
57 #[arg(
58 short = 't',
59 long,
60 value_name = "TO",
61 default_missing_value = "None",
62 help = "The position of the data for ending the reading, defaults to reading until \
63 the end of the file."
64 )]
65 to: Option<u32>,
66 },
67}