8000 Update to clap 3.1.x by Sciencentistguy · Pull Request #289 · atuinsh/atuin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update to clap 3.1.x #289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2022
Merged
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
104 changes: 51 additions & 53 deletions Cargo.lock

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

8000
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ log = "0.4"
pretty_env_logger = "0.4"
chrono = { version = "0.4", features = ["serde"] }
eyre = "0.6"
structopt = "0.3"
directories = "3"
indicatif = "0.16.2"
serde_derive = "1.0.125"
Expand All @@ -56,6 +55,8 @@ base64 = "0.13.0"
humantime = "2.1.0"
tabwriter = "1.2.1"
crossbeam-channel = "0.5.1"
clap = { version = "3.1.8", features = ["derive"] }
clap_complete = "3.1.1"

[profile.release]
lto = "fat"
Expand Down
41 changes: 16 additions & 25 deletions src/command/history.rs
8000
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,51 @@ use std::env;
use std::io::Write;
use std::time::Duration;

use clap::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(infer_subcommands = true)]
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: 8 additions & 22 deletions src/command/import.rs
Original file line number Diff line number Diff line change
@@ -1,44 +1,30 @@
use std::{env, path::PathBuf};

use atuin_client::import::fish::Fish;
use clap::Parser;
use eyre::{eyre, Result};
use structopt::StructOpt;

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

#[derive(StructOpt)]
#[derive(Parser)]
#[clap(infer_subcommands = true)]
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(
about="import history from the fish history file",
aliases=&["f", "fi", "fis"],
)]
/// Import history from the fish history file
Fish,
}

Expand Down
10 changes: 5 additions & 5 deletions src/command/init.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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 setup
Fish,
}

Expand Down
14 changes: 8 additions & 6 deletions src/command/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@ use std::borrow::Cow;
use std::io;

use atuin_common::api::LoginRequest;
use clap::AppSettings;
use clap::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
0