Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 46 additions & 54 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ log = "0.4"
pretty_env_logger = "0.4"
chrono = { version = "0.4", features = ["serde"] }
eyre = "0.6"
structopt = "0.3"
clap = { version = "3.0.0-rc.7", features = ["derive"] }
clap_generate = "3.0.0-rc.7"
directories = "3"
indicatif = "0.16.2"
serde_derive = "1.0.125"
Expand Down
42 changes: 17 additions & 25 deletions src/command/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,52 @@ use std::env;
use std::io::Write;
use std::time::Duration;

use clap::{AppSettings::InferSubcommands, Subcommand};
use eyre::Result;
use structopt::StructOpt;
use tabwriter::TabWriter;

use atuin_client::database::Database;
use atuin_client::history::History;
use atuin_client::settings::Settings;
use atuin_client::sync;

#[derive(StructOpt)]
#[derive(Subcommand)]
#[clap(aliases = &["h", "hi", "his", "hist", "histo", "histor"])]
#[clap(setting(InferSubcommands))]
pub enum Cmd {
#[structopt(
about="begins a new command in the history",
aliases=&["s", "st", "sta", "star"],
)]
/// begins a new command in the history
Start { command: Vec<String> },

#[structopt(
about="finishes a new command in the history (adds time, exit code)",
aliases=&["e", "en"],
)]
/// finishes a new command in the history (adds time, exit code)
End {
id: String,
#[structopt(long, short)]
#[clap(long, short)]
exit: i64,
},

#[structopt(
about="list all items in history",
aliases=&["l", "li", "lis"],
)]
/// list all items in history
List {
#[structopt(long, short)]
#[clap(long, short)]
cwd: bool,

#[structopt(long, short)]
#[clap(long, short)]
session: bool,

#[structopt(long, short)]
#[clap(long)]
human: bool,

#[structopt(long, help = "Show only the text of the command")]
/// Show only the text of the command
#[clap(long)]
cmd_only: bool,
},

#[structopt(
about="get the last command ran",
aliases=&["la", "las"],
)]
/// get the last command ran
Last {
#[structopt(long, short)]
#[clap(long)]
human: bool,

#[structopt(long, help = "Show only the text of the command")]
/// Show only the text of the command
#[clap(long)]
cmd_only: bool,
},
}
Expand Down
30 changes: 9 additions & 21 deletions src/command/import.rs
Original file line number Diff line number Diff line change
@@ -1,41 +1,29 @@
use std::{env, path::PathBuf};

use atuin_client::import::fish::Fish;
use clap::{AppSettings::InferSubcommands, Subcommand};
use eyre::{eyre, Result};
use structopt::StructOpt;

use atuin_client::import::{bash::Bash, zsh::Zsh};
use atuin_client::import::{bash::Bash, fish::Fish, zsh::Zsh};
use atuin_client::{database::Database, import::Importer};
use atuin_client::{history::History, import::resh::Resh};
use indicatif::ProgressBar;

#[derive(StructOpt)]
#[derive(Subcommand)]
#[clap(setting(InferSubcommands))]
pub enum Cmd {
#[structopt(
about="import history for the current shell",
aliases=&["a", "au", "aut"],
)]
/// import history for the current shell
Auto,

#[structopt(
about="import history from the zsh history file",
aliases=&["z", "zs"],
)]
/// import history from the zsh history file
Zsh,

#[structopt(
about="import history from the bash history file",
aliases=&["b", "ba", "bas"],
)]
/// import history from the bash history file
Bash,

#[structopt(
about="import history from the resh history file",
aliases=&["r", "re", "res"],
)]
/// import history from the resh history file
Resh,

#[structopt(
#[clap(
about="import history from the fish history file",
aliases=&["f", "fi", "fis"],
)]
Expand Down
8 changes: 4 additions & 4 deletions src/command/init.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use structopt::StructOpt;
use clap::Parser;

#[derive(StructOpt)]
#[derive(Parser)]
pub enum Cmd {
#[structopt(about = "zsh setup")]
/// zsh setup
Zsh,
#[structopt(about = "bash setup")]
/// bash setup
Bash,
#[structopt(about = "fish setup")]
Fish,
Expand Down
13 changes: 7 additions & 6 deletions src/command/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@ use std::borrow::Cow;
use std::io;

use atuin_common::api::LoginRequest;
use clap::{AppSettings, Parser};
use eyre::Result;
use structopt::StructOpt;
use tokio::{fs::File, io::AsyncWriteExt};

use atuin_client::api_client;
use atuin_client::settings::Settings;

#[derive(StructOpt)]
#[structopt(setting(structopt::clap::AppSettings::DeriveDisplayOrder))]
#[derive(Parser)]
#[clap(setting(AppSettings::DeriveDisplayOrder))]
pub struct Cmd {
#[structopt(long, short)]
#[clap(long, short)]
pub username: Option<String>,

#[structopt(long, short)]
#[clap(long, short)]
pub password: Option<String>,

#[structopt(long, short, help = "the encryption key for your account")]
/// the encryption key for your account
#[clap(long, short)]
pub key: Option<String>,
}

Expand Down
Loading