implemented push and pop commands, push command saves the wrong path though
This commit is contained in:
+16
-13
@@ -1,17 +1,18 @@
|
||||
use clap::{Parser, Args, Subcommand};
|
||||
use std::path::PathBuf;
|
||||
|
||||
|
||||
/// implements stack for cd wrapper script
|
||||
#[derive(Parser, Debug)]
|
||||
#[clap(author, version, about, long_about=None)]
|
||||
pub struct Arguments {
|
||||
/// subcommand
|
||||
#[command(subcommand)]
|
||||
pub action: Action,
|
||||
|
||||
/// process id of parent shell
|
||||
#[arg(short, long)]
|
||||
pub pid: u32,
|
||||
|
||||
/// subcommand
|
||||
#[command(subcommand)]
|
||||
pub action: Action,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Subcommand)]
|
||||
@@ -22,8 +23,8 @@ pub enum Action {
|
||||
/// navigate to last entry in stack and remove it
|
||||
pop(PopArgs),
|
||||
|
||||
/// display stack
|
||||
stack(StackArgs),
|
||||
/// show stack
|
||||
show(ShowArgs),
|
||||
|
||||
/// navigate to bookmark and add current path to the stack
|
||||
bookmark(BookmarkArgs),
|
||||
@@ -33,33 +34,35 @@ pub enum Action {
|
||||
pub struct PushArgs {
|
||||
/// show stack
|
||||
#[arg(short, long)]
|
||||
show_stack: Option<bool>,
|
||||
pub show_stack: Option<bool>,
|
||||
|
||||
/// change to <path>
|
||||
path: String,
|
||||
pub path: PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Args)]
|
||||
pub struct PopArgs {
|
||||
/// show stack
|
||||
#[arg(short, long)]
|
||||
show_stack: Option<bool>,
|
||||
pub show_stack: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Args)]
|
||||
pub struct StackArgs {
|
||||
pub struct ShowArgs {
|
||||
/// hide entry numbers
|
||||
#[arg(short='n', long)]
|
||||
hide_numbers: Option<bool>,
|
||||
pub hide_numbers: Option<bool>,
|
||||
|
||||
/// show n entries
|
||||
#[arg(short, long="lines")]
|
||||
lines: Option<u32>,
|
||||
pub lines: Option<u32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Args)]
|
||||
pub struct BookmarkArgs {
|
||||
/// show stack
|
||||
#[arg(short, long)]
|
||||
show_stack: Option<bool>,
|
||||
pub show_stack: Option<bool>,
|
||||
|
||||
pub mark: String,
|
||||
}
|
||||
Reference in New Issue
Block a user