diff --git a/Cargo.lock b/Cargo.lock index c157178..2985eab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -632,18 +632,17 @@ checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "cling" -version = "0.0.1-alpha.1" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e4a2e71e9fceda49fccfea44aae2de7d76f32a7fd239f2c2be2719cbb3c18f" +checksum = "d6d3c3668d01b3168d5126326fa4181c454fc8430173129170a9eb12d65ffba9" dependencies = [ "anyhow", "async-trait", "clap", - "clap-stdin", "cling-derive", - "colored", "indoc", - "shlex", + "rustc_version", + "rustversion", "static_assertions", "termcolor", "tracing", @@ -651,11 +650,12 @@ dependencies = [ [[package]] name = "cling-derive" -version = "0.0.1-alpha.1" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33def7d20ed0d80fe555bda22d949a6de0519fe763a57ef0871150971447d70d" +checksum = "49a1db6bf280e9890a7663e8e9f299d4b62b3fe4f7e3ec8a6b2c0ee4a7da656a" dependencies = [ "darling", + "indoc", "proc-macro2", "quote", "syn 2.0.29", @@ -822,7 +822,7 @@ dependencies = [ [[package]] name = "cronback-cli" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "async-trait", @@ -3566,12 +3566,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shlex" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" - [[package]] name = "signal-hook-registry" version = "1.4.1" diff --git a/clients/rust/src/client.rs b/clients/rust/src/client.rs index 4560742..c075c1f 100644 --- a/clients/rust/src/client.rs +++ b/clients/rust/src/client.rs @@ -240,8 +240,8 @@ pub(crate) struct ClientConfig { // Ensure that Client is Send + Sync. Compiler will fail if it's not. const _: () = { - fn assert_send() {} - let _ = assert_send::; + const fn assert_send() {} + assert_send::(); }; #[async_trait] diff --git a/cronback-cli/Cargo.toml b/cronback-cli/Cargo.toml index 75896ee..b792558 100644 --- a/cronback-cli/Cargo.toml +++ b/cronback-cli/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cronback-cli" description = "Cronback CLI" -version = "0.1.0" +version = "0.1.1" edition.workspace = true authors.workspace = true license.workspace = true @@ -26,7 +26,7 @@ admin = ["cronback-client/admin", "cronback-api-model/admin"] [dependencies] cronback-client = { workspace = true } cronback-api-model = { workspace = true, features = ["client", "clap"] } -cling = { version = "0.0.1-alpha.1" } +cling = { version = "0.1.0" } anyhow = { version = "1.0.71" } async-trait = { workspace = true } diff --git a/cronback-cli/src/admin/api_keys/create.rs b/cronback-cli/src/admin/api_keys/create.rs index db65490..dafd956 100644 --- a/cronback-cli/src/admin/api_keys/create.rs +++ b/cronback-cli/src/admin/api_keys/create.rs @@ -4,7 +4,7 @@ use cronback_api_model::admin::APIKeyMetaData; use crate::args::CommonOptions; -#[derive(CliRunnable, CliParam, Clone, Debug, Parser)] +#[derive(Run, Collect, Clone, Debug, Parser)] #[cling(run = "create")] pub struct Create { /// The name of the key to be created diff --git a/cronback-cli/src/admin/api_keys/list.rs b/cronback-cli/src/admin/api_keys/list.rs index fa97a43..b24dabf 100644 --- a/cronback-cli/src/admin/api_keys/list.rs +++ b/cronback-cli/src/admin/api_keys/list.rs @@ -4,7 +4,7 @@ use prettytable::{row, Table}; use crate::args::CommonOptions; -#[derive(CliRunnable, Clone, Debug, Parser)] +#[derive(Run, Args, Clone, Debug)] #[cling(run = "list")] pub struct List; diff --git a/cronback-cli/src/admin/api_keys/mod.rs b/cronback-cli/src/admin/api_keys/mod.rs index 5dfc43e..ed4008f 100644 --- a/cronback-cli/src/admin/api_keys/mod.rs +++ b/cronback-cli/src/admin/api_keys/mod.rs @@ -4,7 +4,7 @@ mod create; mod list; mod revoke; -#[derive(CliRunnable, Subcommand, Debug, Clone)] +#[derive(Run, Subcommand, Debug, Clone)] pub enum ApiKeysCommand { /// List API keys #[command(visible_alias = "ls")] diff --git a/cronback-cli/src/admin/api_keys/revoke.rs b/cronback-cli/src/admin/api_keys/revoke.rs index b5b4fbc..3383829 100644 --- a/cronback-cli/src/admin/api_keys/revoke.rs +++ b/cronback-cli/src/admin/api_keys/revoke.rs @@ -4,7 +4,7 @@ use cling::prelude::*; use crate::args::CommonOptions; use crate::confirm::confirm_or_abort; -#[derive(CliRunnable, CliParam, Clone, Debug, Parser)] +#[derive(Run, Collect, Args, Clone, Debug)] #[cling(run = "revoke")] pub struct Revoke { /// The Id of the key to be revoked diff --git a/cronback-cli/src/admin/mod.rs b/cronback-cli/src/admin/mod.rs index c2e57c0..9ed81fc 100644 --- a/cronback-cli/src/admin/mod.rs +++ b/cronback-cli/src/admin/mod.rs @@ -3,7 +3,7 @@ use cling::prelude::*; mod api_keys; mod projects; -#[derive(CliRunnable, Subcommand, Debug, Clone)] +#[derive(Run, Subcommand, Debug, Clone)] pub enum AdminCommand { /// Commands for api key management. This subcommand requires admin /// privilliages. diff --git a/cronback-cli/src/admin/projects/create.rs b/cronback-cli/src/admin/projects/create.rs index bc508e6..f40ecc2 100644 --- a/cronback-cli/src/admin/projects/create.rs +++ b/cronback-cli/src/admin/projects/create.rs @@ -3,7 +3,7 @@ use cling::prelude::*; use crate::args::CommonOptions; -#[derive(CliRunnable, Clone, Debug, Parser)] +#[derive(Run, Args, Clone, Debug)] #[cling(run = "create")] pub struct Create; diff --git a/cronback-cli/src/admin/projects/mod.rs b/cronback-cli/src/admin/projects/mod.rs index 9713a83..cf863ac 100644 --- a/cronback-cli/src/admin/projects/mod.rs +++ b/cronback-cli/src/admin/projects/mod.rs @@ -1,7 +1,7 @@ use cling::prelude::*; mod create; -#[derive(CliRunnable, Subcommand, Debug, Clone)] +#[derive(Run, Subcommand, Debug, Clone)] pub enum ProjectsCommand { /// Create a new API key Create(create::Create), diff --git a/cronback-cli/src/args.rs b/cronback-cli/src/args.rs index ae143e6..337b450 100644 --- a/cronback-cli/src/args.rs +++ b/cronback-cli/src/args.rs @@ -19,7 +19,7 @@ const CRONBACK_SECRET_TOKEN_VAR: &str = "CRONBACK_SECRET_TOKEN"; #[cfg(feature = "admin")] const CRONBACK_PROJECT_ID_VAR: &str = "CRONBACK_PROJECT_ID"; -#[derive(CliRunnable, Parser, Debug, Clone)] +#[derive(Run, Parser, Debug, Clone)] #[cling(run = "crate::init")] /// Command-line utility to manage cronback projects pub struct Cli { @@ -33,7 +33,7 @@ pub struct Cli { pub command: CliCommand, } -#[derive(CliParam, Parser, Debug, Clone)] +#[derive(Collect, Args, Debug, Clone)] pub struct CommonOptions { #[arg(long, global = true)] /// Connect to a local cronback service (http://localhost:8888) @@ -65,7 +65,7 @@ pub struct CommonOptions { pub yes: bool, } -#[derive(CliRunnable, Subcommand, Debug, Clone)] +#[derive(Run, Subcommand, Debug, Clone)] pub enum CliCommand { /// Commands for triggers #[command(subcommand)] @@ -83,7 +83,7 @@ pub enum CliCommand { Admin(admin::AdminCommand), } -#[derive(CliRunnable, Subcommand, Debug, Clone)] +#[derive(Run, Subcommand, Debug, Clone)] pub enum TriggerCommand { /// List triggers #[command(visible_alias = "ls")] @@ -108,7 +108,7 @@ pub enum TriggerCommand { Delete(triggers::Delete), } -#[derive(CliRunnable, Subcommand, Debug, Clone)] +#[derive(Run, Subcommand, Debug, Clone)] pub enum RunsCommand { /// View details about a given trigger run View(runs::View), diff --git a/cronback-cli/src/runs/view.rs b/cronback-cli/src/runs/view.rs index 14a2fd2..2ce44c8 100644 --- a/cronback-cli/src/runs/view.rs +++ b/cronback-cli/src/runs/view.rs @@ -3,7 +3,7 @@ use cling::prelude::*; use crate::args::CommonOptions; -#[derive(CliRunnable, CliParam, Clone, Debug, Parser)] +#[derive(Run, Collect, Args, Clone, Debug)] #[cling(run = "view")] pub struct View { /// Run Id diff --git a/cronback-cli/src/triggers/cancel.rs b/cronback-cli/src/triggers/cancel.rs index 6242f37..08b9ace 100644 --- a/cronback-cli/src/triggers/cancel.rs +++ b/cronback-cli/src/triggers/cancel.rs @@ -5,7 +5,7 @@ use crate::args::CommonOptions; use crate::confirm_or_abort; use crate::ui::FancyToString; -#[derive(CliRunnable, CliParam, Clone, Debug, Parser)] +#[derive(Run, Collect, Args, Clone, Debug)] #[cling(run = "cancel")] pub struct Cancel { /// Trigger name diff --git a/cronback-cli/src/triggers/create.rs b/cronback-cli/src/triggers/create.rs index 6313d45..544d110 100644 --- a/cronback-cli/src/triggers/create.rs +++ b/cronback-cli/src/triggers/create.rs @@ -5,7 +5,7 @@ use cling::prelude::*; use crate::args::CommonOptions; use crate::confirm_or_abort; -#[derive(CliRunnable, CliParam, Clone, Debug, Parser)] +#[derive(Run, Collect, Args, Clone, Debug)] #[cling(run = "create")] pub struct Create { /// JSON file name with the trigger definition, or use - for stdin diff --git a/cronback-cli/src/triggers/delete.rs b/cronback-cli/src/triggers/delete.rs index 231b437..0821794 100644 --- a/cronback-cli/src/triggers/delete.rs +++ b/cronback-cli/src/triggers/delete.rs @@ -4,7 +4,7 @@ use cling::prelude::*; use crate::args::CommonOptions; use crate::confirm_or_abort; -#[derive(CliRunnable, CliParam, Clone, Debug, Parser)] +#[derive(Run, Collect, Args, Clone, Debug)] #[cling(run = "delete")] pub struct Delete { /// Trigger name diff --git a/cronback-cli/src/triggers/list.rs b/cronback-cli/src/triggers/list.rs index f992dfc..b2d6499 100644 --- a/cronback-cli/src/triggers/list.rs +++ b/cronback-cli/src/triggers/list.rs @@ -2,7 +2,6 @@ use std::fmt::Write as FmtWrite; use anyhow::Result; use chrono::{DateTime, Utc}; -use clap::Parser; use cling::prelude::*; use colored::Colorize; use cronback_client::{ @@ -18,7 +17,7 @@ use prettytable::{row, Table}; use crate::args::CommonOptions; use crate::ui::FancyToString; -#[derive(CliRunnable, CliParam, Clone, Debug, Parser)] +#[derive(Run, Collect, Args, Clone, Debug)] #[cling(run = "list")] pub struct List { /// Cursor to start listing from diff --git a/cronback-cli/src/triggers/pause.rs b/cronback-cli/src/triggers/pause.rs index a1d508f..909f76d 100644 --- a/cronback-cli/src/triggers/pause.rs +++ b/cronback-cli/src/triggers/pause.rs @@ -5,7 +5,7 @@ use crate::args::CommonOptions; use crate::confirm_or_abort; use crate::ui::FancyToString; -#[derive(CliRunnable, CliParam, Clone, Debug, Parser)] +#[derive(Run, Collect, Args, Clone, Debug)] #[cling(run = "pause")] pub struct Pause { /// Trigger name diff --git a/cronback-cli/src/triggers/resume.rs b/cronback-cli/src/triggers/resume.rs index a21cbec..4c70573 100644 --- a/cronback-cli/src/triggers/resume.rs +++ b/cronback-cli/src/triggers/resume.rs @@ -1,11 +1,10 @@ use anyhow::Result; -use clap::Parser; use cling::prelude::*; use crate::args::CommonOptions; use crate::ui::FancyToString; -#[derive(CliRunnable, CliParam, Clone, Debug, Parser)] +#[derive(Run, Collect, Args, Clone, Debug)] #[cling(run = "resume")] pub struct Resume { /// Trigger name diff --git a/cronback-cli/src/triggers/run.rs b/cronback-cli/src/triggers/run.rs index 428cce2..fc90572 100644 --- a/cronback-cli/src/triggers/run.rs +++ b/cronback-cli/src/triggers/run.rs @@ -6,7 +6,7 @@ use spinners::{Spinner, Spinners}; use crate::args::CommonOptions; use crate::confirm_or_abort; -#[derive(CliRunnable, CliParam, Clone, Debug, Parser)] +#[derive(Run, Collect, Args, Clone, Debug)] #[cling(run = "run")] pub struct RunArgs { /// Trigger name diff --git a/cronback-cli/src/triggers/runs.rs b/cronback-cli/src/triggers/runs.rs index 115fbd9..41ad0f2 100644 --- a/cronback-cli/src/triggers/runs.rs +++ b/cronback-cli/src/triggers/runs.rs @@ -7,7 +7,7 @@ use prettytable::{row, Table}; use crate::args::CommonOptions; use crate::ui::FancyToString; -#[derive(CliRunnable, CliParam, Clone, Debug, Parser)] +#[derive(Run, Collect, Args, Clone, Debug)] #[cling(run = "list_runs")] pub struct ListRuns { /// Cursor to start listing from diff --git a/cronback-cli/src/triggers/view.rs b/cronback-cli/src/triggers/view.rs index 4e8e747..b9f6e8e 100644 --- a/cronback-cli/src/triggers/view.rs +++ b/cronback-cli/src/triggers/view.rs @@ -3,7 +3,7 @@ use cling::prelude::*; use crate::args::CommonOptions; -#[derive(CliRunnable, CliParam, Clone, Debug, Parser)] +#[derive(Run, Collect, Args, Clone, Debug)] #[cling(run = "view")] pub struct View { /// Trigger name diff --git a/cronback-cli/src/whoami.rs b/cronback-cli/src/whoami.rs index 0a87ae8..1f7ff2a 100644 --- a/cronback-cli/src/whoami.rs +++ b/cronback-cli/src/whoami.rs @@ -4,7 +4,7 @@ use colored::Colorize; use crate::args::CommonOptions; -#[derive(CliRunnable, CliParam, Clone, Debug, Parser)] +#[derive(Run, Collect, Clone, Debug, Parser)] #[cling(run = "whoami")] pub struct WhoAmI { #[arg(long)] diff --git a/cronback-services/src/scheduler/spinner/name_cache.rs b/cronback-services/src/scheduler/spinner/name_cache.rs index 5add720..b95a5ee 100644 --- a/cronback-services/src/scheduler/spinner/name_cache.rs +++ b/cronback-services/src/scheduler/spinner/name_cache.rs @@ -179,8 +179,8 @@ impl NameCache { // Ensure that NameCache is Send + Sync. Compiler will fail if it's not. const _: () = { - fn assert_send() {} - let _ = assert_send::>; + const fn assert_send() {} + assert_send::>(); }; #[cfg(test)]