Skip to content
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

crossterm support #331

Merged
merged 6 commits into from
Feb 10, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
lints
conradludgate committed Jan 28, 2023
commit a40e41caffe69905d5ec78d0f2800bf0080af71e
8 changes: 1 addition & 7 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ tokio = { version = "1", features = ["full"] }
async-trait = "0.1.58"
interim = { version = "0.1.0", features = ["chrono"] }
cli-table = { version = "0.4", default-features = false }
base64 = "0.21.0"
base64 = "0.20.0"
crossbeam-channel = "0.5.1"
clap = { version = "4.0.18", features = ["derive"] }
clap_complete = "4.0.3"
8 changes: 4 additions & 4 deletions atuin-client/src/api_client.rs
Original file line number Diff line number Diff line change
@@ -42,14 +42,14 @@ pub async fn register(
map.insert("email", email);
map.insert("password", password);

let url = format!("{}/user/{}", address, username);
let url = format!("{address}/user/{username}");
let resp = reqwest::get(url).await?;

if resp.status().is_success() {
bail!("username already in use");
}

let url = format!("{}/register", address);
let url = format!("{address}/register");
let client = reqwest::Client::new();
let resp = client
.post(url)
@@ -68,7 +68,7 @@ pub async fn register(
}

pub async fn login(address: &str, req: LoginRequest) -> Result<LoginResponse> {
let url = format!("{}/login", address);
let url = format!("{address}/login");
let client = reqwest::Client::new();

let resp = client
@@ -111,7 +111,7 @@ pub async fn latest_version() -> Result<Version> {
impl<'a> Client<'a> {
pub fn new(sync_addr: &'a str, session_token: &'a str, key: String) -> Result<Self> {
let mut headers = HeaderMap::new();
headers.insert(AUTHORIZATION, format!("Token {}", session_token).parse()?);
headers.insert(AUTHORIZATION, format!("Token {session_token}").parse()?);

Ok(Client {
sync_addr,
3 changes: 2 additions & 1 deletion atuin-client/src/database.rs
Original file line number Diff line number Diff line change
@@ -448,7 +448,8 @@ impl Database for Sqlite {
} else if let Some(term) = query_part.strip_prefix('\'') {
format!("{glob}{term}{glob}")
} else if is_inverse {
format!("{glob}{term}{glob}", term = query_part)
let term = query_part;
format!("{glob}{term}{glob}")
} else {
query_part.split("").join(glob)
};
2 changes: 1 addition & 1 deletion atuin-client/src/import/fish.rs
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ fn default_histpath() -> Result<PathBuf> {
};

let mut histpath = data.join("fish");
histpath.push(format!("{}_history", session));
histpath.push(format!("{session}_history"));

if histpath.exists() {
Ok(histpath)
2 changes: 1 addition & 1 deletion atuin-client/src/import/zsh_histdb.rs
Original file line number Diff line number Diff line change
@@ -221,7 +221,7 @@ mod test {
println!("h: {:#?}", histdb.histdb);
println!("counter: {:?}", histdb.histdb.len());
for i in histdb.histdb {
println!("{:?}", i);
println!("{i:?}");
}
}
}
5 changes: 2 additions & 3 deletions atuin-client/src/settings.rs
Original file line number Diff line number Diff line change
@@ -262,9 +262,8 @@ impl Settings {
let data_dir = atuin_common::utils::data_dir();

create_dir_all(&config_dir)
.wrap_err_with(|| format!("could not create dir {:?}", config_dir))?;
create_dir_all(&data_dir)
.wrap_err_with(|| format!("could not create dir {:?}", data_dir))?;
.wrap_err_with(|| format!("could not create dir {config_dir:?}"))?;
create_dir_all(&data_dir).wrap_err_with(|| format!("could not create dir {data_dir:?}"))?;

let mut config_file = if let Ok(p) = std::env::var("ATUIN_CONFIG_DIR") {
PathBuf::from(p)
3 changes: 1 addition & 2 deletions src/command/client/history.rs
Original file line number Diff line number Diff line change
@@ -257,8 +257,7 @@ impl Cmd {
}
(Some(session), Some(cwd)) => {
let query = format!(
"select * from history where cwd = '{}' and session = '{}';",
cwd, session
"select * from history where cwd = '{cwd}' and session = '{session}';"
);
db.query_history(&query).await?
}