From 5547fb4b802b2837d2750d28d5c942c63a36c5de Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Fri, 27 Mar 2020 19:25:37 +0530 Subject: [PATCH] Rename `migrate` command to `import` --- README.md | 4 ++-- src/db.rs | 4 ++-- src/main.rs | 4 ++-- src/subcommand/{migrate.rs => import.rs} | 8 ++++---- src/subcommand/mod.rs | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) rename src/subcommand/{migrate.rs => import.rs} (66%) diff --git a/README.md b/README.md index a57665d..6a3dbf5 100644 --- a/README.md +++ b/README.md @@ -60,10 +60,10 @@ If you want the interactive fuzzy selection feature, you will also need to insta ### Step 2: Adding `zoxide` to your shell -If you currently use `z`, `z.lua`, or `zsh-z`, you may want to first migrate your existing database to `zoxide`: +If you currently use `z`, `z.lua`, or `zsh-z`, you may want to first import your existing database into `zoxide`: ```sh -zoxide migrate /path/to/db +zoxide import /path/to/db ``` #### zsh diff --git a/src/db.rs b/src/db.rs index eba07e8..e4973c8 100644 --- a/src/db.rs +++ b/src/db.rs @@ -54,10 +54,10 @@ impl DB { Ok(()) } - pub fn migrate>(&mut self, path: P, merge: bool) -> Result<()> { + pub fn import>(&mut self, path: P, merge: bool) -> Result<()> { if !self.dirs.is_empty() && !merge { bail!(indoc!( - "To prevent conflicts, you can only migrate from z with an empty zoxide database! + "To prevent conflicts, you can only import from z with an empty zoxide database! If you wish to merge the two, specify the `--merge` flag." )); } diff --git a/src/main.rs b/src/main.rs index de5d4c7..7e8e681 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,8 +14,8 @@ use structopt::StructOpt; #[structopt(about = "A cd command that learns your habits")] enum Zoxide { Add(subcommand::Add), + Import(subcommand::Import), Init(subcommand::Init), - Migrate(subcommand::Migrate), Query(subcommand::Query), Remove(subcommand::Remove), } @@ -28,8 +28,8 @@ pub fn main() -> Result<()> { match opt { Zoxide::Add(add) => add.run(&env)?, + Zoxide::Import(import) => import.run(&env)?, Zoxide::Init(init) => init.run()?, - Zoxide::Migrate(migrate) => migrate.run(&env)?, Zoxide::Query(query) => query.run(&env)?, Zoxide::Remove(remove) => remove.run(&env)?, }; diff --git a/src/subcommand/migrate.rs b/src/subcommand/import.rs similarity index 66% rename from src/subcommand/migrate.rs rename to src/subcommand/import.rs index 55c5d45..db2926a 100644 --- a/src/subcommand/migrate.rs +++ b/src/subcommand/import.rs @@ -5,16 +5,16 @@ use anyhow::Result; use structopt::StructOpt; #[derive(Debug, StructOpt)] -#[structopt(about = "Migrate from z database")] -pub struct Migrate { +#[structopt(about = "Import from z database")] +pub struct Import { path: String, #[structopt(long, help = "Merge entries into existing database")] merge: bool, } -impl Migrate { +impl Import { pub fn run(&self, env: &Env) -> Result<()> { - util::get_db(env)?.migrate(&self.path, self.merge) + util::get_db(env)?.import(&self.path, self.merge) } } diff --git a/src/subcommand/mod.rs b/src/subcommand/mod.rs index 0aae3cf..6ca5818 100644 --- a/src/subcommand/mod.rs +++ b/src/subcommand/mod.rs @@ -1,11 +1,11 @@ mod add; +mod import; mod init; -mod migrate; mod query; mod remove; pub use add::Add; +pub use import::Import; pub use init::Init; -pub use migrate::Migrate; pub use query::Query; pub use remove::Remove;