Rename
This commit is contained in:
parent
e3661daf81
commit
07aceb3dd4
5 changed files with 31 additions and 33 deletions
28
Cargo.lock
generated
28
Cargo.lock
generated
|
@ -41,6 +41,20 @@ dependencies = [
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "atuin"
|
||||||
|
version = "0.1.1"
|
||||||
|
dependencies = [
|
||||||
|
"chrono",
|
||||||
|
"directories",
|
||||||
|
"eyre",
|
||||||
|
"log",
|
||||||
|
"pretty_env_logger",
|
||||||
|
"rusqlite",
|
||||||
|
"shellexpand",
|
||||||
|
"structopt",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
|
@ -449,20 +463,6 @@ dependencies = [
|
||||||
"dirs",
|
"dirs",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "shync"
|
|
||||||
version = "0.1.1"
|
|
||||||
dependencies = [
|
|
||||||
"chrono",
|
|
||||||
"directories",
|
|
||||||
"eyre",
|
|
||||||
"log",
|
|
||||||
"pretty_env_logger",
|
|
||||||
"rusqlite",
|
|
||||||
"shellexpand",
|
|
||||||
"structopt",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.4.2"
|
version = "1.4.2"
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
name = "shync"
|
name = "atuin"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
authors = ["Ellie Huxtable <e@elm.sh>"]
|
authors = ["Ellie Huxtable <e@elm.sh>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
description = "shync - sync your shell history"
|
description = "atuin - sync your shell history"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
Through the fathomless deeps of space swims the star turtle Great A’Tuin, bearing on its back the four giant elephants who carry on their shoulders the mass of the Discworld.
|
Through the fathomless deeps of space swims the star turtle Great A’Tuin, bearing on its back the four giant elephants who carry on their shoulders the mass of the Discworld.
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
`atuin` manages and synchronizes your shell history!
|
`atuin` manages and synchronizes your shell history!
|
||||||
|
|
6
hook.zsh
6
hook.zsh
|
@ -1,7 +1,7 @@
|
||||||
# Source this in your ~/.zshrc
|
# Source this in your ~/.zshrc
|
||||||
|
|
||||||
_shync_preexec(){
|
_atuin_preexec(){
|
||||||
shync history add $1
|
atuin history add $1
|
||||||
}
|
}
|
||||||
|
|
||||||
add-zsh-hook preexec _shync_preexec
|
add-zsh-hook preexec _atuin_preexec
|
||||||
|
|
22
src/main.rs
22
src/main.rs
|
@ -20,16 +20,16 @@ use local::history::History;
|
||||||
version = "0.1.0",
|
version = "0.1.0",
|
||||||
about = "Keep your shell history in sync"
|
about = "Keep your shell history in sync"
|
||||||
)]
|
)]
|
||||||
struct Shync {
|
struct Atuin {
|
||||||
#[structopt(long, parse(from_os_str), help = "db file path")]
|
#[structopt(long, parse(from_os_str), help = "db file path")]
|
||||||
db: Option<PathBuf>,
|
db: Option<PathBuf>,
|
||||||
|
|
||||||
#[structopt(subcommand)]
|
#[structopt(subcommand)]
|
||||||
shync: ShyncCmd,
|
atuin: AtuinCmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(StructOpt)]
|
#[derive(StructOpt)]
|
||||||
enum ShyncCmd {
|
enum AtuinCmd {
|
||||||
#[structopt(
|
#[structopt(
|
||||||
about="manipulate shell history",
|
about="manipulate shell history",
|
||||||
aliases=&["h", "hi", "his", "hist", "histo", "histor"],
|
aliases=&["h", "hi", "his", "hist", "histo", "histor"],
|
||||||
|
@ -39,11 +39,11 @@ enum ShyncCmd {
|
||||||
#[structopt(about = "import shell history from file")]
|
#[structopt(about = "import shell history from file")]
|
||||||
Import,
|
Import,
|
||||||
|
|
||||||
#[structopt(about = "start a shync server")]
|
#[structopt(about = "start a atuin server")]
|
||||||
Server,
|
Server,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Shync {
|
impl Atuin {
|
||||||
fn run(self) -> Result<()> {
|
fn run(self) -> Result<()> {
|
||||||
let db_path = match self.db {
|
let db_path = match self.db {
|
||||||
Some(db_path) => {
|
Some(db_path) => {
|
||||||
|
@ -54,9 +54,9 @@ impl Shync {
|
||||||
PathBuf::from(path.as_ref())
|
PathBuf::from(path.as_ref())
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let project_dirs = ProjectDirs::from("bike", "ellie", "shync").ok_or(eyre!(
|
let project_dirs = ProjectDirs::from("com", "elliehuxtable", "atuin").ok_or(
|
||||||
"could not determine db file location\nspecify one using the --db flag"
|
eyre!("could not determine db file location\nspecify one using the --db flag"),
|
||||||
))?;
|
)?;
|
||||||
let root = project_dirs.data_dir();
|
let root = project_dirs.data_dir();
|
||||||
root.join("history.db")
|
root.join("history.db")
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,8 @@ impl Shync {
|
||||||
|
|
||||||
let db = SqliteDatabase::new(db_path)?;
|
let db = SqliteDatabase::new(db_path)?;
|
||||||
|
|
||||||
match self.shync {
|
match self.atuin {
|
||||||
ShyncCmd::History(history) => history.run(db),
|
AtuinCmd::History(history) => history.run(db),
|
||||||
_ => Ok(()),
|
_ => Ok(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,5 +108,5 @@ impl HistoryCmd {
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
pretty_env_logger::init();
|
pretty_env_logger::init();
|
||||||
|
|
||||||
Shync::from_args().run()
|
Atuin::from_args().run()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue