Skip to content

Commit

Permalink
Rename --virtual and --physical options
Browse files Browse the repository at this point in the history
to --create and --attach respectively

Closes #10
  • Loading branch information
rfdonnelly committed Aug 2, 2023
1 parent c96f584 commit c9b08f4
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Create virtual serial ports, connect them to physical serial port
authors = ["Rob Donnelly"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/rfdonnelly/vsp-router"
keywords = ["serial", "socat", "ttybus", "virtual", "router"]
keywords = ["serial", "socat", "ttybus", "virtual", "router", "com0com", "hub4com"]
categories = ["command-line-utilities"]

[profile.release]
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Create virtual serial ports, connect them to physical serial ports, and create routes between them all.

vsp-router was created to connect two terminal emulators to the same physical RS-232 [serial console](https://tldp.org/HOWTO/Remote-Serial-Console-HOWTO/intro-why.html).
Vsp-router was created to connect two terminal emulators to the same physical RS-232 [serial console](https://tldp.org/HOWTO/Remote-Serial-Console-HOWTO/intro-why.html).

[![asciicast](https://asciinema.org/a/519137.svg)](https://asciinema.org/a/519137)

Expand All @@ -23,9 +23,9 @@ Multiplex two virutal serial ports to a single physical serial port.

```sh
vsp-router \
--virtual 0 \
--virtual 1 \
--physical 2:/dev/ttyUSB0 \
--create 0 \
--create 1 \
--attach 2:/dev/ttyUSB0 \
--route 0:2 \
--route 1:2 \
--route 2:0 \
Expand All @@ -36,9 +36,9 @@ Multiplex two virutal serial ports to a third virtual serial port.

```sh
vsp-router \
--virtual 0 \
--virtual 1 \
--virtual 2 \
--create 0 \
--create 1 \
--create 2 \
--route 0:2 \
--route 1:2 \
--route 2:0 \
Expand All @@ -51,9 +51,9 @@ In terminal A

```sh
cargo run -- \
--virtual 0 \
--virtual 1 \
--virtual 2 \
--create 0 \
--create 1 \
--create 2 \
--route 0:2 \
--route 1:2 \
--route 2:0 \
Expand Down Expand Up @@ -105,9 +105,9 @@ vsp-router

```sh
vsp-router \
--virtual 0 \
--virtual 1 \
--virtual 2 \
--create 0 \
--create 1 \
--create 2 \
--route 0:1 \
--route 0:2 \
--route 1:0 \
Expand Down
24 changes: 12 additions & 12 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,39 @@ pub(crate) struct Cli {
///
/// Examples:
///
/// --virtual path/to/file
/// --create path/to/file
///
/// The path is 'path/to/file' and the ID is 'file'.
///
/// --virtual 0:dev/ttyUSB0
/// --create 0:dev/ttyUSB0
///
/// The path is '/dev/ttyUSB0' and the ID is '0'.
#[arg(long = "virtual", id = "VIRTUAL", verbatim_doc_comment)]
#[arg(long = "create", id = "CREATE", verbatim_doc_comment)]
pub(crate) virtuals: Vec<Virtual>,

/// Open a physical serial port.
/// Attach to an existing serial port.
///
/// The argument takes the following form: '[<id>:]<path>[,<baud-rate>]'
///
/// If ID is not specified, the ID is set to the basename of the path. If baud rate is not specified,
/// the baud rate defaults to 9600.
///
/// Can use multiple times to attached multiple physical serial ports.
/// Can use multiple times to attach multiple serial ports.
///
/// Examples:
///
/// --physical /dev/ttyUSB0
/// --attach /dev/ttyUSB0
///
/// The path is '/dev/ttyUSB0', the ID is 'ttyUSB0', and the baud rate is 9600.
///
/// --physical 1:/dev/ttyUSB0
/// --attach 1:/dev/ttyUSB0
///
/// The path is '/dev/ttyUSB0', the ID is '1', and the baud rate is 9600.
///
/// --physical 1:/dev/ttyUSB0,115200
/// --attach 1:/dev/ttyUSB0,115200
///
/// The path is '/dev/ttyUSB0', the ID is '1', and the baud rate is 115200.
#[arg(long = "physical", id = "PHYSICAL", verbatim_doc_comment)]
#[arg(long = "attach", id = "ATTACH", verbatim_doc_comment)]
pub(crate) physicals: Vec<Physical>,

/// Create a route between a source port and a destination port.
Expand Down Expand Up @@ -85,9 +85,9 @@ const CLAP_AFTER_HELP: &str = color_print::cstr!(
both virtual serial ports.
vsp-router \\
--virtual 0 \\
--virtual 1 \\
--physical 2:/dev/ttyUSB0,115200 \\
--create 0 \\
--create 1 \\
--attach 2:/dev/ttyUSB0,115200 \\
--route 0:2 \\
--route 1:2 \\
--route 2:0 \\
Expand Down
24 changes: 12 additions & 12 deletions tests/snapshots/cli-help-long.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Create virtual serial ports, connect them to physical serial ports, and create r
Usage: vsp-router [OPTIONS]

Options:
--virtual <VIRTUAL>
--create <CREATE>
Create a virtual serial port.

NOTE: This option is only applicable on POSIX platforms. This option is
Expand All @@ -17,35 +17,35 @@ Options:

Examples:

--virtual path/to/file
--create path/to/file

The path is 'path/to/file' and the ID is 'file'.

--virtual 0:dev/ttyUSB0
--create 0:dev/ttyUSB0

The path is '/dev/ttyUSB0' and the ID is '0'.

--physical <PHYSICAL>
Open a physical serial port.
--attach <ATTACH>
Attach to an existing serial port.

The argument takes the following form: '[<id>:]<path>[,<baud-rate>]'

If ID is not specified, the ID is set to the basename of the path. If baud rate is not specified,
the baud rate defaults to 9600.

Can use multiple times to attached multiple physical serial ports.
Can use multiple times to attach multiple serial ports.

Examples:

--physical /dev/ttyUSB0
--attach /dev/ttyUSB0

The path is '/dev/ttyUSB0', the ID is 'ttyUSB0', and the baud rate is 9600.

--physical 1:/dev/ttyUSB0
--attach 1:/dev/ttyUSB0

The path is '/dev/ttyUSB0', the ID is '1', and the baud rate is 9600.

--physical 1:/dev/ttyUSB0,115200
--attach 1:/dev/ttyUSB0,115200

The path is '/dev/ttyUSB0', the ID is '1', and the baud rate is 115200.

Expand Down Expand Up @@ -79,9 +79,9 @@ Examples:
both virtual serial ports.

vsp-router /
--virtual 0 /
--virtual 1 /
--physical 2:/dev/ttyUSB0,115200 /
--create 0 /
--create 1 /
--attach 2:/dev/ttyUSB0,115200 /
--route 0:2 /
--route 1:2 /
--route 2:0 /
Expand Down

0 comments on commit c9b08f4

Please sign in to comment.