feat(jump): done, but not great
Of course, the calling process is different from us, and we can't actually change their PWD >_< *sigh* But, this can be put in e.g. an alias, which seems to be what most jump/cd expanding types of programs do. We are not those, so, going beyond what most of those do with ptrace and hackery is not really in scope... But ugh, I hate this. But I still want this feature for myself so ¯\_(ツ)_/¯ Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
parent
082ab57957
commit
969bff4dd1
2 changed files with 13 additions and 6 deletions
|
@ -119,9 +119,9 @@ pub enum Commands {
|
||||||
pub enum JumpCommands {
|
pub enum JumpCommands {
|
||||||
/// Jump to repo
|
/// Jump to repo
|
||||||
#[command(visible_alias = "r")]
|
#[command(visible_alias = "r")]
|
||||||
Repo { name: Option<String> },
|
Repo { category: String, name: String },
|
||||||
|
|
||||||
/// Jump to link
|
/// Jump to link
|
||||||
#[command(visible_alias = "l")]
|
#[command(visible_alias = "l")]
|
||||||
Link { name: Option<String> },
|
Link { category: String, name: String },
|
||||||
}
|
}
|
||||||
|
|
13
src/main.rs
13
src/main.rs
|
@ -43,7 +43,7 @@ mod settings;
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
use cli::{Args, Commands};
|
use cli::{Args, Commands, JumpCommands};
|
||||||
use git::Config;
|
use git::Config;
|
||||||
use utils::strings::{FAST_COMMIT, QUICK_COMMIT};
|
use utils::strings::{FAST_COMMIT, QUICK_COMMIT};
|
||||||
|
|
||||||
|
@ -107,9 +107,16 @@ fn main() {
|
||||||
Some(Commands::CommitMsg { msg }) => {
|
Some(Commands::CommitMsg { msg }) => {
|
||||||
config.commit_all_msg(msg.as_ref().expect("failed to get message from input"));
|
config.commit_all_msg(msg.as_ref().expect("failed to get message from input"));
|
||||||
}
|
}
|
||||||
Some(Commands::Jump(_)) => {
|
Some(Commands::Jump(cmd)) => match cmd {
|
||||||
todo!();
|
JumpCommands::Repo { category, name } => {
|
||||||
|
config.get_repo(category, name, |repo| {
|
||||||
|
println!("{}{}", repo.path, repo.name);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
JumpCommands::Link { category, name } => {
|
||||||
|
config.get_link(category, name, |link| println!("{}", link.tx));
|
||||||
|
}
|
||||||
|
},
|
||||||
None => (),
|
None => (),
|
||||||
}
|
}
|
||||||
trace!("{:?}", config);
|
trace!("{:?}", config);
|
||||||
|
|
Loading…
Reference in a new issue