Skip to content

Commit

Permalink
cli: split commands/config.rs into sub modules
Browse files Browse the repository at this point in the history
  • Loading branch information
yuja committed Aug 1, 2024
1 parent bfa1ce8 commit 9168500
Show file tree
Hide file tree
Showing 7 changed files with 440 additions and 327 deletions.
327 changes: 0 additions & 327 deletions cli/src/commands/config.rs

This file was deleted.

40 changes: 40 additions & 0 deletions cli/src/commands/config/edit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2020 The Jujutsu Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use tracing::instrument;

use super::ConfigLevelArgs;
use crate::cli_util::{get_new_config_file_path, run_ui_editor, CommandHelper};
use crate::command_error::CommandError;
use crate::ui::Ui;

/// Start an editor on a jj config file.
///
/// Creates the file if it doesn't already exist regardless of what the editor
/// does.
#[derive(clap::Args, Clone, Debug)]
pub struct ConfigEditArgs {
#[command(flatten)]
pub level: ConfigLevelArgs,
}

#[instrument(skip_all)]
pub fn cmd_config_edit(
_ui: &mut Ui,
command: &CommandHelper,
args: &ConfigEditArgs,
) -> Result<(), CommandError> {
let config_path = get_new_config_file_path(&args.level.expect_source_kind(), command)?;
run_ui_editor(command.settings(), &config_path)
}
Loading

0 comments on commit 9168500

Please sign in to comment.