use crate::cli_util::CommandHelper;
use crate::command_error::CommandError;
use crate::movement_util::Direction;
use crate::movement_util::MovementArgs;
use crate::movement_util::move_to_commit;
use crate::ui::Ui;
#[derive(clap::Args, Clone, Debug)]
#[command(verbatim_doc_comment)]
pub(crate) struct NextArgs {
#[arg(default_value = "1")]
offset: u64,
#[arg(long, short)]
edit: bool,
#[arg(long, short, conflicts_with = "edit")]
no_edit: bool,
#[arg(long, conflicts_with = "offset")]
conflict: bool,
}
impl From<&NextArgs> for MovementArgs {
fn from(val: &NextArgs) -> Self {
Self {
offset: val.offset,
edit: val.edit,
no_edit: val.no_edit,
conflict: val.conflict,
}
}
}
pub(crate) async fn cmd_next(
ui: &mut Ui,
command: &CommandHelper,
args: &NextArgs,
) -> Result<(), CommandError> {
move_to_commit(ui, command, Direction::Next, &MovementArgs::from(args)).await
}