Skip to content

Commit 372569c

Browse files
committed
Add --version flag and detailed help text for auth subcommands
1 parent 43ace78 commit 372569c

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "xcli"
3-
version = "1.1.0"
3+
version = "1.1.1"
44
edition = "2021"
55
description = "X (Twitter) API CLI tool"
66
license = "MIT"

src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use config::{ApiKeys, Config, Credentials};
88
use std::io::{self, Write};
99

1010
#[derive(Parser)]
11-
#[command(name = "xcli", about = "X (Twitter) API CLI")]
11+
#[command(name = "xcli", version, about = "X (Twitter) API CLI")]
1212
struct Cli {
1313
#[command(subcommand)]
1414
command: Commands,
@@ -27,6 +27,7 @@ enum Commands {
2727
id: String,
2828
},
2929
/// Manage authentication
30+
#[command(long_about = "Manage authentication\n\nExamples:\n xcli auth setup --api-key KEY --api-secret SECRET\n xcli auth login\n xcli auth status\n xcli auth logout")]
3031
Auth {
3132
#[command(subcommand)]
3233
action: AuthAction,
@@ -36,12 +37,16 @@ enum Commands {
3637
#[derive(Subcommand)]
3738
enum AuthAction {
3839
/// Login via OAuth (opens browser)
40+
#[command(long_about = "Login via OAuth (opens browser)\n\nStarts a 3-legged OAuth flow: opens the browser for authorization,\nthen saves the access token to ~/.config/xcli/credentials.json.\nRequires API keys (run `xcli auth setup` first or set .env).")]
3941
Login,
4042
/// Logout (delete stored credentials)
43+
#[command(long_about = "Logout (delete stored credentials)\n\nRemoves ~/.config/xcli/credentials.json.\nAPI keys in keys.json are kept.")]
4144
Logout,
4245
/// Show current auth status
46+
#[command(long_about = "Show current auth status\n\nDisplays the logged-in screen name and credentials path,\nor indicates that no user is logged in.")]
4347
Status,
4448
/// Set up API keys
49+
#[command(long_about = "Set up API keys\n\nSaves API keys to ~/.config/xcli/keys.json.\nPass keys as arguments or omit them for interactive prompts.\n\nExamples:\n xcli auth setup --api-key KEY --api-secret SECRET\n xcli auth setup --api-key KEY --api-secret SECRET --access-token TOKEN --access-token-secret TOKEN_SECRET\n xcli auth setup (interactive)")]
4550
Setup {
4651
/// API Key (Consumer Key)
4752
#[arg(long)]

0 commit comments

Comments
 (0)