| 1 |
// Copyright 2020-2023 The Jujutsu Authors |
| 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 |
// https://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 |
|
| 15 |
mod annotate; |
| 16 |
mod chmod; |
| 17 |
mod list; |
| 18 |
mod search; |
| 19 |
mod show; |
| 20 |
mod track; |
| 21 |
mod untrack; |
| 22 |
|
| 23 |
use crate::cli_util::CommandHelper; |
| 24 |
use crate::command_error::CommandError; |
| 25 |
use crate::ui::Ui; |
| 26 |
|
| 27 |
/// File operations. |
| 28 |
#[derive(clap::Subcommand, Clone, Debug)] |
| 29 |
pub enum FileCommand { |
| 30 |
Annotate(annotate::FileAnnotateArgs), |
| 31 |
Chmod(chmod::FileChmodArgs), |
| 32 |
List(list::FileListArgs), |
| 33 |
Search(search::FileSearchArgs), |
| 34 |
Show(show::FileShowArgs), |
| 35 |
Track(track::FileTrackArgs), |
| 36 |
Untrack(untrack::FileUntrackArgs), |
| 37 |
} |
| 38 |
|
| 39 |
pub async fn cmd_file( |
| 40 |
ui: &mut Ui, |
| 41 |
command: &CommandHelper, |
| 42 |
subcommand: &FileCommand, |
| 43 |
) -> Result<(), CommandError> { |
| 44 |
match subcommand { |
| 45 |
FileCommand::Annotate(args) => annotate::cmd_file_annotate(ui, command, args).await, |
| 46 |
FileCommand::Chmod(args) => chmod::cmd_file_chmod(ui, command, args).await, |
| 47 |
FileCommand::List(args) => list::cmd_file_list(ui, command, args).await, |
| 48 |
FileCommand::Search(args) => search::cmd_file_search(ui, command, args).await, |
| 49 |
FileCommand::Show(args) => show::cmd_file_show(ui, command, args).await, |
| 50 |
FileCommand::Track(args) => track::cmd_file_track(ui, command, args).await, |
| 51 |
FileCommand::Untrack(args) => untrack::cmd_file_untrack(ui, command, args).await, |
| 52 |
} |
| 53 |
} |