mirror of
https://github.com/atuinsh/atuin.git
synced 2024-11-22 08:13:57 +01:00
infer subcommands where appropriate
This commit is contained in:
parent
dffc5ba9e8
commit
8444fedd29
@ -2,7 +2,7 @@ use std::env;
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use clap::Subcommand;
|
use clap::{AppSettings::InferSubcommands, Subcommand};
|
||||||
use eyre::Result;
|
use eyre::Result;
|
||||||
use tabwriter::TabWriter;
|
use tabwriter::TabWriter;
|
||||||
|
|
||||||
@ -13,13 +13,12 @@ use atuin_client::sync;
|
|||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
#[clap(aliases = &["h", "hi", "his", "hist", "histo", "histor"])]
|
#[clap(aliases = &["h", "hi", "his", "hist", "histo", "histor"])]
|
||||||
|
#[clap(setting(InferSubcommands))]
|
||||||
pub enum Cmd {
|
pub enum Cmd {
|
||||||
/// "begins a new command in the history
|
/// begins a new command in the history
|
||||||
#[clap(aliases=&["s", "st", "sta", "star"])]
|
|
||||||
Start { command: Vec<String> },
|
Start { command: Vec<String> },
|
||||||
|
|
||||||
/// finishes a new command in the history (adds time, exit code)
|
/// finishes a new command in the history (adds time, exit code)
|
||||||
#[clap(aliases=&["e", "en"])]
|
|
||||||
End {
|
End {
|
||||||
id: String,
|
id: String,
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
@ -27,7 +26,6 @@ pub enum Cmd {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/// list all items in history
|
/// list all items in history
|
||||||
#[clap(aliases=&["l", "li", "lis"])]
|
|
||||||
List {
|
List {
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
cwd: bool,
|
cwd: bool,
|
||||||
@ -44,7 +42,6 @@ pub enum Cmd {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/// get the last command ran
|
/// get the last command ran
|
||||||
#[clap(aliases=&["la", "las"])]
|
|
||||||
Last {
|
Last {
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
human: bool,
|
human: bool,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::{env, path::PathBuf};
|
use std::{env, path::PathBuf};
|
||||||
|
|
||||||
use clap::Subcommand;
|
use clap::{AppSettings::InferSubcommands, Subcommand};
|
||||||
use eyre::{eyre, Result};
|
use eyre::{eyre, Result};
|
||||||
|
|
||||||
use atuin_client::import::{bash::Bash, fish::Fish, zsh::Zsh};
|
use atuin_client::import::{bash::Bash, fish::Fish, zsh::Zsh};
|
||||||
@ -9,29 +9,18 @@ use atuin_client::{history::History, import::resh::Resh};
|
|||||||
use indicatif::ProgressBar;
|
use indicatif::ProgressBar;
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
|
#[clap(setting(InferSubcommands))]
|
||||||
pub enum Cmd {
|
pub enum Cmd {
|
||||||
#[clap(
|
/// import history for the current shell
|
||||||
about="import history for the current shell",
|
|
||||||
aliases=&["a", "au", "aut"],
|
|
||||||
)]
|
|
||||||
Auto,
|
Auto,
|
||||||
|
|
||||||
#[clap(
|
/// import history from the zsh history file
|
||||||
about="import history from the zsh history file",
|
|
||||||
aliases=&["z", "zs"],
|
|
||||||
)]
|
|
||||||
Zsh,
|
Zsh,
|
||||||
|
|
||||||
#[clap(
|
/// import history from the bash history file
|
||||||
about="import history from the bash history file",
|
|
||||||
aliases=&["b", "ba", "bas"],
|
|
||||||
)]
|
|
||||||
Bash,
|
Bash,
|
||||||
|
|
||||||
#[clap(
|
/// import history from the resh history file
|
||||||
about="import history from the resh history file",
|
|
||||||
aliases=&["r", "re", "res"],
|
|
||||||
)]
|
|
||||||
Resh,
|
Resh,
|
||||||
|
|
||||||
#[clap(
|
#[clap(
|
||||||
|
@ -2,9 +2,9 @@ use clap::Parser;
|
|||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
pub enum Cmd {
|
pub enum Cmd {
|
||||||
#[clap(about = "zsh setup")]
|
/// zsh setup
|
||||||
Zsh,
|
Zsh,
|
||||||
#[clap(about = "bash setup")]
|
/// bash setup
|
||||||
Bash,
|
Bash,
|
||||||
#[structopt(about = "fish setup")]
|
#[structopt(about = "fish setup")]
|
||||||
Fish,
|
Fish,
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
use clap::Subcommand;
|
use clap::{AppSettings::InferSubcommands, Subcommand};
|
||||||
use eyre::Result;
|
use eyre::Result;
|
||||||
|
|
||||||
use atuin_server::launch;
|
use atuin_server::launch;
|
||||||
use atuin_server::settings::Settings;
|
use atuin_server::settings::Settings;
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
|
#[clap(setting(InferSubcommands))]
|
||||||
pub enum Cmd {
|
pub enum Cmd {
|
||||||
#[clap(
|
/// starts the server
|
||||||
about="starts the server",
|
|
||||||
aliases=&["s", "st", "sta", "star"],
|
|
||||||
)]
|
|
||||||
Start {
|
Start {
|
||||||
/// specify the host address to bind
|
/// specify the host address to bind
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
|
@ -4,7 +4,7 @@ use chrono::prelude::*;
|
|||||||
use chrono::Duration;
|
use chrono::Duration;
|
||||||
use chrono_english::parse_date_string;
|
use chrono_english::parse_date_string;
|
||||||
|
|
||||||
use clap::Subcommand;
|
use clap::{AppSettings::InferSubcommands, Subcommand};
|
||||||
use cli_table::{format::Justify, print_stdout, Cell, Style, Table};
|
use cli_table::{format::Justify, print_stdout, Cell, Style, Table};
|
||||||
use eyre::{eyre, Result};
|
use eyre::{eyre, Result};
|
||||||
|
|
||||||
@ -13,17 +13,12 @@ use atuin_client::history::History;
|
|||||||
use atuin_client::settings::Settings;
|
use atuin_client::settings::Settings;
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
|
#[clap(setting(InferSubcommands))]
|
||||||
pub enum Cmd {
|
pub enum Cmd {
|
||||||
#[clap(
|
/// compute statistics for all of time
|
||||||
about="compute statistics for all of time",
|
|
||||||
aliases=&["d", "da"],
|
|
||||||
)]
|
|
||||||
All,
|
All,
|
||||||
|
|
||||||
#[clap(
|
/// compute statistics for a single day
|
||||||
about="compute statistics for a single day",
|
|
||||||
aliases=&["d", "da"],
|
|
||||||
)]
|
|
||||||
Day { words: Vec<String> },
|
Day { words: Vec<String> },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user