Skip to content
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
12 changes: 11 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ path = "src/main.rs"
polymarket-client-sdk = { version = "0.4", features = ["gamma", "data", "bridge", "clob", "ctf"] }
alloy = { version = "1.6.3", default-features = false, features = ["providers", "sol-types", "contract", "reqwest", "reqwest-rustls-tls", "signer-local", "signers"] }
clap = { version = "4", features = ["derive"] }
clap_complete = "4"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
serde_json = "1"
serde = { version = "1", features = ["derive"] }
Expand Down
17 changes: 16 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ mod shell;

use std::process::ExitCode;

use clap::{Parser, Subcommand};
use clap::{CommandFactory, Parser, Subcommand};
use clap_complete::Shell;
use output::OutputFormat;

#[derive(Parser)]
Expand Down Expand Up @@ -64,6 +65,11 @@ enum Commands {
Status,
/// Update to the latest version
Upgrade,
/// Generate shell completions
Completions {
/// Shell to generate completions for
shell: Shell,
},
}

#[tokio::main]
Expand Down Expand Up @@ -117,6 +123,15 @@ pub(crate) async fn run(cli: Cli) -> anyhow::Result<()> {
commands::wallet::execute(args, cli.output, cli.private_key.as_deref())
}
Commands::Upgrade => commands::upgrade::execute(),
Commands::Completions { shell } => {
clap_complete::generate(
shell,
&mut Cli::command(),
"polymarket",
&mut std::io::stdout(),
);
Ok(())
}
Commands::Status => {
let status = gamma.status().await?;
match cli.output {
Expand Down