Skip to content
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
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## [0.2.0](https://github.com/syncable-dev/syncable-cli/compare/v0.1.5...v0.2.0) - 2025-06-06

### Added

- Added tool install verifier with cli calls ([#14](https://github.com/syncable-dev/syncable-cli/pull/14))

## [0.1.5](https://github.com/syncable-dev/syncable-cli/compare/v0.1.4...v0.1.5) - 2025-06-06

### Added

- cargo lock update

### Other

- Feature/update dependabot ([#11](https://github.com/syncable-dev/syncable-cli/pull/11))
- Update README.md
- Update README.md
- *(deps)* bump reqwest from 0.11.27 to 0.12.19
- *(deps)* bump dirs from 5.0.1 to 6.0.0
- Feature/dependabot ([#3](https://github.com/syncable-dev/syncable-cli/pull/3))

## [0.1.4](https://github.com/syncable-dev/syncable-cli/compare/v0.1.3...v0.1.4) - 2025-06-05

### Added
Expand Down
2 changes: 1 addition & 1 deletion 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
@@ -1,6 +1,6 @@
[package]
name = "syncable-cli"
version = "0.1.4"
version = "0.2.0"
edition = "2024"
authors = ["Syncable Team"]
description = "A Rust-based CLI that analyzes code repositories and generates Infrastructure as Code configurations"
Expand Down
30 changes: 19 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::fs;
use std::path::PathBuf;
use std::time::{SystemTime, Duration};
use dirs::cache_dir;
use reqwest::blocking::get;

#[tokio::main]
async fn main() {
Expand Down Expand Up @@ -119,16 +118,25 @@ fn check_for_update() {
}
}

// Query crates.io
let resp = get("https://crates.io/api/v1/crates/syncable-cli")
.and_then(|r| r.json::<serde_json::Value>());
if let Ok(json) = resp {
let latest = json["crate"]["max_version"].as_str().unwrap_or("");
let current = env!("CARGO_PKG_VERSION");
if latest != "" && latest != current {
println!(
"\x1b[33m🔔 A new version of sync-ctl is available: {latest} (current: {current})\nRun `cargo install syncable-cli --force` to update.\x1b[0m"
);
// Query crates.io with proper User-Agent header
let client = reqwest::blocking::Client::builder()
.user_agent(format!("syncable-cli/{} ({})", env!("CARGO_PKG_VERSION"), env!("CARGO_PKG_REPOSITORY")))
.build();

if let Ok(client) = client {
let resp = client
.get("https://crates.io/api/v1/crates/syncable-cli")
.send()
.and_then(|r| r.json::<serde_json::Value>());

if let Ok(json) = resp {
let latest = json["crate"]["max_version"].as_str().unwrap_or("");
let current = env!("CARGO_PKG_VERSION");
if latest != "" && latest != current {
println!(
"\x1b[33m🔔 A new version of sync-ctl is available: {latest} (current: {current})\nRun `cargo install syncable-cli --force` to update.\x1b[0m"
);
}
}
}

Expand Down