Skip to content

Commit

Permalink
directvt#464 WIP: XLinkVT mode (docs)
Browse files Browse the repository at this point in the history
  • Loading branch information
o-sdn-o committed Dec 1, 2023
1 parent 51f1a1e commit a96472a
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 59 deletions.
22 changes: 22 additions & 0 deletions doc/apps.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Built-in Applications
- `▀▄ Term` Terminal Emulator
- `▀▄ DirectVT` DirectVT Proxy Console
- `▀▄ XLinkVT` DirectVT Proxy Console with controlling terminal onboard
- `▀▄ View` Workspace Navigation Helper
- `▀▄ Tile` Tiling Window anager

Expand Down Expand Up @@ -234,6 +235,27 @@ TerminalStdioLog | Stdin/stdout log toggle.

...

This console mode is activated by the `-r dtvt` option.

Example:
```
vtm -r dtvt vtm -r truecolor
```

# DirectVT Proxy Console with controlling terminal onboard

This console mode is used when there is a need for interactive interaction with the user through the controlling terminal. For example, this is required when connecting via SSH with keyboard-interactive authentication or requesting a private key passphrase.

This mode is enabled automatically if the first command line argument begins with `ssh` literal.

The following commands are identical:
```
vtm -r xlvt ssh user@host vtm
```
```
vtm ssh user@host vtm
```

# Workspace Navigation Helper

## Features
Expand Down
1 change: 1 addition & 0 deletions doc/command-line-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Application | Description
------------|------------------------------------------
`Term` | Terminal emulator (default)
`DTVT` | DirectVT Proxy Console
`XLVT` | DirectVT Proxy Console with controlling terminal onboard (Cross-linked VT)
`Calc` | Spreadsheet calculator (Demo)
`Text` | Text editor (Demo)
`Gems` | Application manager (Demo)
Expand Down
1 change: 1 addition & 0 deletions doc/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ Type | Format
Type | Parameter | Description
------------------|------------------|-----------
`DirectVT` | `_command line_` | Run `_command line_` using DirectVT protocol. Usage example `type=DirectVT param="_command line_"`.
`XLVT`\|`XLinkVT` | `_command line_` | Run `_command line_` using DirectVT protocol with controlling terminal attached for OpenSSH interactivity. Usage example `type=XLVT param="_command line_"`.
`ANSIVT` | `_command line_` | Run `_command line_` inside the built-in terminal. Usage example `type=ANSIVT param="_command line_"`. Same as `type=DirectVT param="$0 -r term _command line_"`.
`SHELL` (default) | `_command line_` | Run `_command line_` on top of a system shell that runs inside the built-in terminal. Usage example `type=SHELL param="_command line_"`. Same as `type=DirectVT param="$0 -r term _shell_ -c _command line_"`.
`Group` | [[ v[`n:m:w`] \| h[`n:m:w`] ] ( id_1 \| _nested_block_ , id_2 \| _nested_block_ )] | Run tiling window manager with layout specified in `param`. Usage example `type=Group param="h1:1(Term, Term)"`.
Expand Down
8 changes: 6 additions & 2 deletions src/netxs/apps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ namespace netxs::app::truecolor
static constexpr auto id = "truecolor";
static constexpr auto desc = "ANSI Art Test";
}
namespace netxs::app::ssh
{
static constexpr auto id = "ssh";
}
namespace netxs::app::headless
{
static constexpr auto id = "headless";
Expand Down Expand Up @@ -46,12 +50,12 @@ namespace netxs::app::dtvt
namespace netxs::app::xlinkvt
{
static constexpr auto id = "xlinkvt";
static constexpr auto desc = "XLinkVT Console";
static constexpr auto desc = "XLinkVT Console (Cross-linked VT)";
}
namespace netxs::app::xlvt
{
static constexpr auto id = "xlvt";
static constexpr auto desc = "XLinkVT Console";
static constexpr auto desc = "XLinkVT Console (Cross-linked VT)";
}
namespace netxs::app::shell
{
Expand Down
27 changes: 14 additions & 13 deletions src/netxs/apps/calc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,25 @@ int main(int argc, char* argv[])
{
os::fail(errmsg);
log("\n"
" Syntax:\n"
"\n Syntax:"
"\n"
" " + os::process::binary<true>() + " [ -c <file> ] [ -l ]\n"
"\n " + os::process::binary<true>() + " [ -c <file> ] [ -l ]"
"\n"
" Options:\n"
"\n Options:"
"\n"
" No arguments Run application.\n"
" -c, --config <..> Load specified settings file.\n"
" -l, --listconfig Show configuration and exit.\n"
"\n No arguments Run application."
"\n -c, --config <..> Load specified settings file."
"\n -l, --listconfig Show configuration and exit."
"\n"
" Settings loading and merging order:\n"
"\n Settings loading and merging order:"
"\n"
" - Initialize hardcoded settings\n"
" - Merge with explicitly specified settings from --config <file>\n"
" - If the --config option is not used or <file> cannot be loaded:\n"
" - Merge with system-wide settings from " + os::path::expand(app::shared::sys_config).second + "\n"
" - Merge with user-wise settings from " + os::path::expand(app::shared::usr_config).second + "\n"
" - Merge with DirectVT packet received from the parent process (dtvt-mode only)\n");
"\n - Initialize hardcoded settings"
"\n - Merge with explicitly specified settings from --config <file>"
"\n - If the --config option is not used or <file> cannot be loaded:"
"\n - Merge with system-wide settings from " + os::path::expand(app::shared::sys_config).second +
"\n - Merge with user-wise settings from " + os::path::expand(app::shared::usr_config).second +
"\n - Merge with DirectVT packet received from the parent process (dtvt-mode only)"
"\n");
}
else if (cfonly)
{
Expand Down
27 changes: 14 additions & 13 deletions src/netxs/apps/term.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,25 @@ int main(int argc, char* argv[])
{
os::fail(errmsg);
log("\n"
" Syntax:\n"
"\n Syntax:"
"\n"
" " + os::process::binary<true>() + " [ -c <file> ] [ -l ]\n"
"\n " + os::process::binary<true>() + " [ -c <file> ] [ -l ]"
"\n"
" Options:\n"
"\n Options:"
"\n"
" No arguments Run application.\n"
" -c, --config <..> Load specified settings file.\n"
" -l, --listconfig Show configuration and exit.\n"
"\n No arguments Run application."
"\n -c, --config <..> Load specified settings file."
"\n -l, --listconfig Show configuration and exit."
"\n"
" Settings loading and merging order:\n"
"\n Settings loading and merging order:"
"\n"
" - Initialize hardcoded settings\n"
" - Merge with explicitly specified settings from --config <file>\n"
" - If the --config option is not used or <file> cannot be loaded:\n"
" - Merge with system-wide settings from " + os::path::expand(app::shared::sys_config).second + "\n"
" - Merge with user-wise settings from " + os::path::expand(app::shared::usr_config).second + "\n"
" - Merge with DirectVT packet received from the parent process (dtvt-mode only)\n");
"\n - Initialize hardcoded settings"
"\n - Merge with explicitly specified settings from --config <file>"
"\n - If the --config option is not used or <file> cannot be loaded:"
"\n - Merge with system-wide settings from " + os::path::expand(app::shared::sys_config).second +
"\n - Merge with user-wise settings from " + os::path::expand(app::shared::usr_config).second +
"\n - Merge with DirectVT packet received from the parent process (dtvt-mode only)"
"\n");
}
else if (cfonly)
{
Expand Down
7 changes: 7 additions & 0 deletions src/netxs/desktopio/system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2095,6 +2095,13 @@ namespace netxs::os
}
// args: Return true if not the end.
operator bool () const { return iter != data.end(); }
// args: Test the starting substring of the current argument.
template<class ...Args>
auto starts(Args&&... args)
{
auto result = iter != data.end() && (iter->starts_with(args) || ...);
return result;
}
// args: Test the current argument and step forward if met.
template<class ...Args>
auto match(Args&&... args)
Expand Down
74 changes: 43 additions & 31 deletions src/vtm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ int main(int argc, char* argv[])
auto errmsg = text{};
auto vtpipe = text{};
auto getopt = os::process::args{ argc, argv };
while (getopt)
if (getopt.starts(app::ssh::id))
{
whoami = type::runapp;
params = getopt.rest();
}
else while (getopt)
{
if (getopt.match("-r", "--runapp"))
{
Expand Down Expand Up @@ -116,44 +121,45 @@ int main(int argc, char* argv[])
if (errmsg.size())
{
failed(code::errormsg);
log("\n"
"Virtual terminal multiplexer with window manager and session sharing.\n"
log("\nVirtual terminal multiplexer."
"\n"
"\n Syntax:"
"\n"
" Syntax:\n"
"\n " + os::process::binary<true>() + " [ -c <file> ] [ -p <pipe> ] [ -q ] [ -l | -m | -d | -s | -r [<app> [<args...>]] ]"
"\n"
" " + os::process::binary<true>() + " [ -c <file> ] [ -p <pipe> ] [ -q ] [ -l | -m | -d | -s | -r [<app> [<args...>]] ]\n"
"\n Options:"
"\n"
" Options:\n"
"\n No arguments Run client, auto start server if it is not running."
"\n -c, --config <..> Load specified settings file."
"\n -p, --pipe <..> Set the pipe to connect to."
"\n -q, --quiet Disable logging."
"\n -l, --listconfig Show configuration and exit."
"\n -m, --monitor Monitor server log."
"\n -d, --daemon Run server in background."
"\n -s, --server Run server in interactive mode."
"\n -r, --runapp <..> Run standalone application."
"\n -v, --version Show version and exit."
"\n -?, -h, --help Show usage message."
"\n --onlylog Disable interactive user input."
"\n"
" No arguments Run client, auto start server if it is not running.\n"
" -c, --config <..> Load specified settings file.\n"
" -p, --pipe <..> Set the pipe to connect to.\n"
" -q, --quiet Disable logging.\n"
" -l, --listconfig Show configuration and exit.\n"
" -m, --monitor Monitor server log.\n"
" -d, --daemon Run server in background.\n"
" -s, --server Run server in interactive mode.\n"
" -r, --runapp <..> Run standalone application.\n"
" -v, --version Show version and exit.\n"
" -?, -h, --help Show usage message.\n"
" --onlylog Disable interactive user input.\n"
"\n Settings loading and merging order:"
"\n"
" Settings loading and merging order:\n"
"\n - Initialize hardcoded settings"
"\n - Merge with explicitly specified settings from --config <file>"
"\n - If the --config option is not used or <file> cannot be loaded:"
"\n - Merge with system-wide settings from " + os::path::expand(app::shared::sys_config).second +
"\n - Merge with user-wise settings from " + os::path::expand(app::shared::usr_config).second +
"\n - Merge with DirectVT packet received from the parent process (dtvt-mode only)"
"\n"
" - Initialize hardcoded settings\n"
" - Merge with explicitly specified settings from --config <file>\n"
" - If the --config option is not used or <file> cannot be loaded:\n"
" - Merge with system-wide settings from " + os::path::expand(app::shared::sys_config).second + "\n"
" - Merge with user-wise settings from " + os::path::expand(app::shared::usr_config).second + "\n"
" - Merge with DirectVT packet received from the parent process (dtvt-mode only)\n"
"\n Registered applications:"
"\n"
" Registered applications:\n"
"\n Term Terminal emulator (default)"
"\n DTVT DirectVT Proxy Console"
"\n XLVT DTVT with controlling terminal onboard (for OpenSSH interactivity)"
"\n Text (Demo) Text editor"
"\n Calc (Demo) Spreadsheet calculator"
"\n Gems (Demo) Application distribution hub"
"\n"
" Term Terminal emulator (default)\n"
" DTVT DirectVT Proxy Console\n"
" Text (Demo) Text editor\n"
" Calc (Demo) Spreadsheet calculator\n"
" Gems (Demo) Application distribution hub\n"
);
}
else if (whoami == type::config)
Expand Down Expand Up @@ -212,6 +218,12 @@ int main(int argc, char* argv[])
else if (shadow.starts_with(app::headless::id)) { aclass = app::headless::id; apname = app::headless::desc; }
else if (shadow.starts_with(app::settings::id)) { aclass = app::settings::id; apname = app::settings::desc; }
else if (shadow.starts_with(app::truecolor::id)) { aclass = app::truecolor::id; apname = app::truecolor::desc; }
else if (shadow.starts_with(app::ssh::id))
{
params = " "s + params;
aclass = app::xlvt::id;
apname = app::xlvt::desc;
}
else
{
params = " "s + params;
Expand Down

0 comments on commit a96472a

Please sign in to comment.