mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-12-29 12:32:40 +00:00
Rename migrate
command to import
This commit is contained in:
parent
76dfaad9a1
commit
5547fb4b80
@ -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
|
||||
|
@ -54,10 +54,10 @@ impl DB {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn migrate<P: AsRef<Path>>(&mut self, path: P, merge: bool) -> Result<()> {
|
||||
pub fn import<P: AsRef<Path>>(&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."
|
||||
));
|
||||
}
|
||||
|
@ -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)?,
|
||||
};
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user