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

Upgrade cli to cling 0.1.0 #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
22 changes: 8 additions & 14 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions clients/rust/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: Send + Sync>() {}
let _ = assert_send::<Client>;
const fn assert_send<T: Send + Sync>() {}
assert_send::<Client>();
};

#[async_trait]
Expand Down
4 changes: 2 additions & 2 deletions cronback-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/admin/api_keys/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/admin/api_keys/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/admin/api_keys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/admin/api_keys/revoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/admin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/admin/projects/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/admin/projects/mod.rs
Original file line number Diff line number Diff line change
@@ -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),
Expand Down
10 changes: 5 additions & 5 deletions cronback-cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down Expand Up @@ -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)]
Expand All @@ -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")]
Expand All @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/runs/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/triggers/cancel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/triggers/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/triggers/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions cronback-cli/src/triggers/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/triggers/pause.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions cronback-cli/src/triggers/resume.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/triggers/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/triggers/runs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/triggers/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cronback-cli/src/whoami.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
4 changes: 2 additions & 2 deletions cronback-services/src/scheduler/spinner/name_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ impl<E> NameCache<E> {

// Ensure that NameCache is Send + Sync. Compiler will fail if it's not.
const _: () = {
fn assert_send<T: Send + Sync>() {}
let _ = assert_send::<NameCache<anyhow::Error>>;
const fn assert_send<T: Send + Sync>() {}
assert_send::<NameCache<anyhow::Error>>();
};

#[cfg(test)]
Expand Down
Loading