Skip to content

Commit

Permalink
doc: Add comments for command (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
fioncat authored Jan 24, 2024
1 parent bc763a0 commit c785a54
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 2 deletions.
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.

14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
all:
@cargo build --release --locked --color=always --verbose

.PHONY: install
install:
@cargo install --path . --force

.PHONY: clean
clean:
@rm -rf ./target

.PHONY: cloc
cloc:
cloc --exclude-dir target .
2 changes: 1 addition & 1 deletion csync/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "csync"
version = "0.2.0"
version = "0.1.0"
edition = "2021"

[dependencies.csync_proto]
Expand Down
15 changes: 15 additions & 0 deletions csync/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,48 @@ use clap::Parser;
use csync_proto::client::{Client, TerminalPassword};
use regex::Regex;

/// Clipboard synchronization client
#[derive(Parser, Debug)]
#[command(author, version = env!("BUILD_VERSION"), about)]
pub struct Config {
/// The target format is `[<publish>@]<addr>[/<subs>]`.
/// Both `publish` and `subs` cannot be empty at the same time.
#[clap(default_value = "default@127.0.0.1")]
pub target: String,

/// The port for the csyncd server.
#[clap(long, short, default_value = "7703")]
pub port: u32,

/// Force skipping authentication. If csyncd is configured with
/// authentication, the program will fail.
#[clap(long)]
pub no_auth: bool,

/// Display synchronization results without outputting the
/// synchronized clipboard text content to the terminal.
#[clap(long, short = 'q')]
pub quiet_content: bool,

/// Display nothing.
#[clap(long, short = 'Q')]
pub quiet_all: bool,

/// Only output the received content to the terminal without writing
/// it to the clipboard.
#[clap(long, short = 'R')]
pub read_only: bool,

/// Receive and transmit only text content, ignoring images.
#[clap(long, short = 'T')]
pub text_only: bool,

/// Interval in milliseconds between attempts to fetch data from
/// the server.
#[clap(long, short = 'i', default_value = "500")]
pub pull_interval: u32,

/// Show build info.
#[clap(long)]
pub build_info: bool,
}
Expand Down
5 changes: 5 additions & 0 deletions csyncd/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
use clap::Parser;

/// Clipboard synchronization server.
#[derive(Parser, Debug)]
#[command(author, version = env!("BUILD_VERSION"), about)]
pub struct Config {
/// The listen address
#[clap(long, short, default_value = "0.0.0.0:7703")]
pub addr: String,

/// The auth password to generate key
#[clap(long, short)]
pub password: Option<String>,

/// Show debug logs
#[clap(long)]
pub debug: bool,

/// Show build info
#[clap(long)]
pub build_info: bool,
}

0 comments on commit c785a54

Please sign in to comment.