worm_hole 1.5.0

CLI tool to easily jump between directories
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::{db::Database, error::WHResult, path::DirPath};
use clap::Parser;

#[derive(Parser, Debug)]
pub struct AddAlias {
	/// The alias to use to go to the location
	pub alias: String,
	/// The real path to the location
	#[clap(default_value = ".")]
	pub path: DirPath,
}

impl AddAlias {
	pub fn run(&self, database: &Database) -> WHResult<()> {
		database.add_alias(self.alias.as_str(), self.path.str())
	}
}