mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +02:00
edit command
This commit is contained in:
parent
7a96e6cd71
commit
43481a5960
5 changed files with 70 additions and 9 deletions
15
src/args.rs
15
src/args.rs
|
|
@ -77,6 +77,10 @@ pub enum HazeArgs {
|
|||
command: Option<HazeCommand>,
|
||||
},
|
||||
Version,
|
||||
Edit {
|
||||
filter: Option<String>,
|
||||
path: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
|
|
@ -282,6 +286,13 @@ impl HazeArgs {
|
|||
Ok(HazeArgs::Help { command })
|
||||
}
|
||||
HazeCommand::Version => Ok(HazeArgs::Version),
|
||||
HazeCommand::Edit => Ok(HazeArgs::Edit {
|
||||
filter,
|
||||
path: args
|
||||
.next()
|
||||
.ok_or_else(|| Report::msg("No path provided"))?
|
||||
.into(),
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -368,6 +379,9 @@ pub enum HazeCommand {
|
|||
/// Show version number
|
||||
#[strum(serialize = "--version", to_string = "version")]
|
||||
Version,
|
||||
/// Edit a file in the instance with $EDITOR on the host
|
||||
#[strum(props(Args = "[path] file to edit"))]
|
||||
Edit,
|
||||
}
|
||||
|
||||
impl HazeCommand {
|
||||
|
|
@ -384,6 +398,7 @@ impl HazeCommand {
|
|||
| HazeCommand::Pin
|
||||
| HazeCommand::Unpin
|
||||
| HazeCommand::Env
|
||||
| HazeCommand::Edit
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue