Rename to ht

This commit is contained in:
Marcin Kulik
2024-04-10 15:51:16 +02:00
parent 3b9155ca99
commit 34f8c138ae
6 changed files with 33 additions and 33 deletions

View File

@@ -54,6 +54,6 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/vt
asset_name: vt-${{ matrix.target }}$
file: target/${{ matrix.target }}/release/ht
asset_name: ht-${{ matrix.target }}$
tag: ${{ github.ref }}

24
Cargo.lock generated
View File

@@ -143,6 +143,18 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "ht"
version = "0.1.0"
dependencies = [
"anyhow",
"avt",
"clap",
"mio",
"nix",
"serde_json",
]
[[package]]
name = "itoa"
version = "1.0.11"
@@ -284,18 +296,6 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "vt"
version = "0.1.0"
dependencies = [
"anyhow",
"avt",
"clap",
"mio",
"nix",
"serde_json",
]
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"

View File

@@ -1,5 +1,5 @@
[package]
name = "vt"
name = "ht"
version = "0.1.0"
edition = "2021"
rust-version = "1.74"

View File

@@ -1,4 +1,4 @@
# vt / hvt / vterm / virterm / termviewer / termproxy / ?
# ht - headless terminal
TODO description
@@ -28,40 +28,40 @@ cargo build --release
```
This produces the binary in _release mode_ (`--release`) at
`target/release/vt`. There are no other build artifacts so you can just
`target/release/ht`. There are no other build artifacts so you can just
copy the binary to a directory in your `$PATH`.
## Usage
Run `vt` to start interactive bash shell running in a PTY (pseudo-terminal).
Run `ht` to start interactive bash shell running in a PTY (pseudo-terminal).
To launch a different program (a different shell, another program) run `vt
To launch a different program (a different shell, another program) run `ht
<command> <args...>`. For example:
- `vt fish` - starts fish shell
- `vt nano` - starts nano editor
- `vt nano /etc/fstab` - starts nano editor with /etc/fstab opened
- `ht fish` - starts fish shell
- `ht nano` - starts nano editor
- `ht nano /etc/fstab` - starts nano editor with /etc/fstab opened
Another way to run a specific program, e.g. `nano`, is to launch `vt` without a
Another way to run a specific program, e.g. `nano`, is to launch `ht` without a
command, i.e. use bash by default, and start nano from bash by sending `nano\r`
("nano" followed by "return" control character) to the process input. See [input
command](#input) below.
Default size of the virtual terminal window is 120x40 (cols by rows), which can
be changed with `--size` argument. For example: `vt --size 80x24`. The window
be changed with `--size` argument. For example: `ht --size 80x24`. The window
size can also be dynamically changed - see [resize command](#resize) below.
Run `vt -h` or `vt --help` to see all available options.
Run `ht -h` or `ht --help` to see all available options.
## API
Communication with vt is performed via stdin, stdout and stderr.
Communication with ht is performed via stdin, stdout and stderr.
vt uses simple JSON-based protocol for sending commands to its stdin. Each
ht uses simple JSON-based protocol for sending commands to its stdin. Each
command must be sent on a separate line and be a JSON object having `"type"`
field set to one the supported commands (below).
vt sends responses (where applicable) to its stdout, as JSON-encoded objects.
ht sends responses (where applicable) to its stdout, as JSON-encoded objects.
Diagnostic messages (notices, errors) are printed to stderr.
@@ -104,17 +104,17 @@ This command doesn't produce any output on stdout.
## Testing on command line
vt is aimed at programmatic use given its JSON-based API, however one can play
ht is aimed at programmatic use given its JSON-based API, however one can play
with it by just launching it in a normal desktop terminal emulator and typing in
JSON-encoded commands from keyboard and observing the output on stdout.
[rlwrap](https://github.com/hanslub42/rlwrap) can be used to wrap stdin in a
readline based editable prompt, which also provides history (up/down arrows).
To use `rlwrap` with `vt`:
To use `rlwrap` with `ht`:
```sh
rlwrap vt [vt-args...]
rlwrap ht [ht-args...]
```
## License

View File

@@ -1,5 +1,5 @@
{
description = "vt";
description = "ht";
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixpkgs-unstable;

View File

@@ -5,7 +5,7 @@ use std::{fmt::Display, ops::Deref, str::FromStr};
#[derive(Debug, Parser)]
#[clap(version, about)]
#[command(name = "vt")]
#[command(name = "ht")]
pub struct Cli {
/// Terminal size
#[arg(long, value_name = "COLSxROWS", default_value = Some("120x40"))]