diff options
| author | diogo464 <[email protected]> | 2025-08-11 16:55:21 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-08-11 16:55:26 +0100 |
| commit | febcfc499657c8d17092611c647598eeee2b9653 (patch) | |
| tree | 49d4cd3eb4592da164b43ffc930e99265c63c474 /src | |
| parent | a361e446d0a168d00ab908b22902dccf47ed36a1 (diff) | |
cli: added log subcommand
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index d8cd56b..3e8cd95 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -724,6 +724,7 @@ enum Cmd { | |||
| 724 | Ls(LsArgs), | 724 | Ls(LsArgs), |
| 725 | Import(ImportArgs), | 725 | Import(ImportArgs), |
| 726 | Blob(BlobArgs), | 726 | Blob(BlobArgs), |
| 727 | Log(LogArgs), | ||
| 727 | } | 728 | } |
| 728 | 729 | ||
| 729 | #[derive(Debug, Args)] | 730 | #[derive(Debug, Args)] |
| @@ -833,6 +834,12 @@ struct BlobArgs { | |||
| 833 | blob_id: BlobId, | 834 | blob_id: BlobId, |
| 834 | } | 835 | } |
| 835 | 836 | ||
| 837 | #[derive(Debug, Args)] | ||
| 838 | struct LogArgs { | ||
| 839 | #[clap(flatten)] | ||
| 840 | common: CliCommon, | ||
| 841 | } | ||
| 842 | |||
| 836 | fn main() { | 843 | fn main() { |
| 837 | let cli = Cli::parse(); | 844 | let cli = Cli::parse(); |
| 838 | 845 | ||
| @@ -844,6 +851,7 @@ fn main() { | |||
| 844 | Cmd::Ls(args) => cmd_ls(args), | 851 | Cmd::Ls(args) => cmd_ls(args), |
| 845 | Cmd::Import(args) => cmd_import(args), | 852 | Cmd::Import(args) => cmd_import(args), |
| 846 | Cmd::Blob(args) => cmd_blob(args), | 853 | Cmd::Blob(args) => cmd_blob(args), |
| 854 | Cmd::Log(args) => cmd_log(args), | ||
| 847 | } | 855 | } |
| 848 | } | 856 | } |
| 849 | 857 | ||
| @@ -1109,6 +1117,13 @@ fn cmd_blob(args: BlobArgs) { | |||
| 1109 | println!("{}", path.display()); | 1117 | println!("{}", path.display()); |
| 1110 | } | 1118 | } |
| 1111 | 1119 | ||
| 1120 | fn cmd_log(args: LogArgs) { | ||
| 1121 | let ops = common_read_log_file(&args.common); | ||
| 1122 | for op in ops { | ||
| 1123 | println!("{op}"); | ||
| 1124 | } | ||
| 1125 | } | ||
| 1126 | |||
| 1112 | fn collect_all_file_paths(root: &Path) -> Vec<PathBuf> { | 1127 | fn collect_all_file_paths(root: &Path) -> Vec<PathBuf> { |
| 1113 | let mut queue = vec![root.to_path_buf()]; | 1128 | let mut queue = vec![root.to_path_buf()]; |
| 1114 | let mut files = vec![]; | 1129 | let mut files = vec![]; |
