From f01cf519dc360704ef7e5b0a0b10ad82ec9256a1 Mon Sep 17 00:00:00 2001 From: "Soren L. Hansen" Date: Mon, 19 Apr 2021 03:20:01 -0700 Subject: [PATCH] Automate options documentation --- Makefile | 7 +++++-- README.md | 57 +++++++++++++++++++++++++++------------------------ README.md.in | 30 +++------------------------ README.md.sed | 8 ++++++++ 4 files changed, 46 insertions(+), 56 deletions(-) create mode 100644 README.md.sed diff --git a/Makefile b/Makefile index eb13a8c..81280fa 100644 --- a/Makefile +++ b/Makefile @@ -65,10 +65,13 @@ js/node_modules/webpack: npm install README.md: README.md.in - (cat $< ; git log --pretty=format:' * %aN' | \ + git log --pretty=format:' * %aN' | \ grep -v 'S.*ren L. Hansen' | \ grep -v 'Iwasaki Yudai' | \ - sort -u ) > $@ + sort -u > contributors.txt.tmp + ./gotty --help | sed '1,/GLOBAL OPTIONS/ d' > options.txt.tmp + sed -f README.md.sed < $< > $@ + rm contributors.txt.tmp options.txt.tmp tools: go get github.com/tools/godep diff --git a/README.md b/README.md index 0d36cef..2920238 100644 --- a/README.md +++ b/README.md @@ -45,33 +45,34 @@ By default, GoTTY starts a web server at port 8080. Open the URL on your web bro ## Options ``` ---address value, -a value IP address to listen (default: "0.0.0.0") [$GOTTY_ADDRESS] ---port value, -p value Port number to listen (default: "8080") [$GOTTY_PORT] ---path value, -m value Base path (default: "/") [$GOTTY_PATH] ---permit-write, -w Permit clients to write to the TTY (BE CAREFUL) [$GOTTY_PERMIT_WRITE] ---credential value, -c value Credential for Basic Authentication (ex: user:pass, default disabled) [$GOTTY_CREDENTIAL] ---random-url, -r Add a random string to the URL [$GOTTY_RANDOM_URL] ---random-url-length value Random URL length (default: 8) [$GOTTY_RANDOM_URL_LENGTH] ---tls, -t Enable TLS/SSL [$GOTTY_TLS] ---tls-crt value TLS/SSL certificate file path (default: "~/.gotty.crt") [$GOTTY_TLS_CRT] ---tls-key value TLS/SSL key file path (default: "~/.gotty.key") [$GOTTY_TLS_KEY] ---tls-ca-crt value TLS/SSL CA certificate file for client certifications (default: "~/.gotty.ca.crt") [$GOTTY_TLS_CA_CRT] ---index value Custom index.html file [$GOTTY_INDEX] ---title-format value Title format of browser window (default: "{{ .command }}@{{ .hostname }}") [$GOTTY_TITLE_FORMAT] ---reconnect Enable reconnection [$GOTTY_RECONNECT] ---reconnect-time value Time to reconnect (default: 10) [$GOTTY_RECONNECT_TIME] ---max-connection value Maximum connection to gotty (default: 0) [$GOTTY_MAX_CONNECTION] ---once Accept only one client and exit on disconnection [$GOTTY_ONCE] ---timeout value Timeout seconds for waiting a client(0 to disable) (default: 0) [$GOTTY_TIMEOUT] ---permit-arguments Permit clients to send command line arguments in URL (e.g. http://example.com:8080/?arg=AAA&arg=BBB) [$GOTTY_PERMIT_ARGUMENTS] ---width value Static width of the screen, 0(default) means dynamically resize (default: 0) [$GOTTY_WIDTH] ---height value Static height of the screen, 0(default) means dynamically resize (default: 0) [$GOTTY_HEIGHT] ---ws-origin value A regular expression that matches origin URLs to be accepted by WebSocket. No cross origin requests are acceptable by default [$GOTTY_WS_ORIGIN] ---term value Terminal name to use on the browser, one of xterm or hterm. (default: "xterm") [$GOTTY_TERM] ---close-signal value Signal sent to the command process when gotty close it (default: SIGHUP) (default: 1) [$GOTTY_CLOSE_SIGNAL] ---close-timeout value Time in seconds to force kill process after client is disconnected (default: -1) (default: -1) [$GOTTY_CLOSE_TIMEOUT] ---config value Config file path (default: "~/.gotty") [$GOTTY_CONFIG] ---version, -v print the version + --address value, -a value IP address to listen (default: "0.0.0.0") [$GOTTY_ADDRESS] + --port value, -p value Port number to liten (default: "8080") [$GOTTY_PORT] + --path value, -m value Base path (default: "/") [$GOTTY_PATH] + --permit-write, -w Permit clients to write to the TTY (BE CAREFUL) (default: false) [$GOTTY_PERMIT_WRITE] + --credential value, -c value Credential for Basic Authentication (ex: user:pass, default disabled) [$GOTTY_CREDENTIAL] + --random-url, -r Add a random string to the URL (default: false) [$GOTTY_RANDOM_URL] + --random-url-length value Random URL length (default: 8) [$GOTTY_RANDOM_URL_LENGTH] + --tls, -t Enable TLS/SSL (default: false) [$GOTTY_TLS] + --tls-crt value TLS/SSL certificate file path (default: "~/.gotty.crt") [$GOTTY_TLS_CRT] + --tls-key value TLS/SSL key file path (default: "~/.gotty.key") [$GOTTY_TLS_KEY] + --tls-ca-crt value TLS/SSL CA certificate file for client certifications (default: "~/.gotty.ca.crt") [$GOTTY_TLS_CA_CRT] + --index value Custom index.html file [$GOTTY_INDEX] + --title-format value Title format of browser window (default: "{{ .command }}@{{ .hostname }}") [$GOTTY_TITLE_FORMAT] + --reconnect Enable reconnection (default: false) [$GOTTY_RECONNECT] + --reconnect-time value Time to reconnect (default: 10) [$GOTTY_RECONNECT_TIME] + --max-connection value Maximum connection to gotty (default: 0) [$GOTTY_MAX_CONNECTION] + --once Accept only one client and exit on disconnection (default: false) [$GOTTY_ONCE] + --timeout value Timeout seconds for waiting a client(0 to disable) (default: 0) [$GOTTY_TIMEOUT] + --permit-arguments Permit clients to send command line arguments in URL (e.g. http://example.com:8080/?arg=AAA&arg=BBB) (default: false) [$GOTTY_PERMIT_ARGUMENTS] + --width value Static width of the screen, 0(default) means dynamically resize (default: 0) [$GOTTY_WIDTH] + --height value Static height of the screen, 0(default) means dynamically resize (default: 0) [$GOTTY_HEIGHT] + --ws-origin value A regular expression that matches origin URLs to be accepted by WebSocket. No cross origin requests are acceptable by default [$GOTTY_WS_ORIGIN] + --term value Terminal name to use on the browser, one of xterm or hterm. (default: "hterm") [$GOTTY_TERM] + --close-signal value Signal sent to the command process when gotty close it (default: SIGHUP) (default: 1) [$GOTTY_CLOSE_SIGNAL] + --close-timeout value Time in seconds to force kill process after client is disconnected (default: -1) (default: -1) [$GOTTY_CLOSE_TIMEOUT] + --config value Config file path (default: "~/.gotty") [$GOTTY_CONFIG] + --help, -h show help (default: false) + --version, -v print the version (default: false) ``` ### Config File @@ -202,7 +203,9 @@ The MIT License * Søren L. Hansen ## Contributors + * 0xflotus + * Anand Patil * Andrea Lusuardi - uovobw * Andy Skelton * Artem Medvedev diff --git a/README.md.in b/README.md.in index 53e0844..64a6a25 100644 --- a/README.md.in +++ b/README.md.in @@ -45,33 +45,7 @@ By default, GoTTY starts a web server at port 8080. Open the URL on your web bro ## Options ``` ---address value, -a value IP address to listen (default: "0.0.0.0") [$GOTTY_ADDRESS] ---port value, -p value Port number to listen (default: "8080") [$GOTTY_PORT] ---path value, -m value Base path (default: "/") [$GOTTY_PATH] ---permit-write, -w Permit clients to write to the TTY (BE CAREFUL) [$GOTTY_PERMIT_WRITE] ---credential value, -c value Credential for Basic Authentication (ex: user:pass, default disabled) [$GOTTY_CREDENTIAL] ---random-url, -r Add a random string to the URL [$GOTTY_RANDOM_URL] ---random-url-length value Random URL length (default: 8) [$GOTTY_RANDOM_URL_LENGTH] ---tls, -t Enable TLS/SSL [$GOTTY_TLS] ---tls-crt value TLS/SSL certificate file path (default: "~/.gotty.crt") [$GOTTY_TLS_CRT] ---tls-key value TLS/SSL key file path (default: "~/.gotty.key") [$GOTTY_TLS_KEY] ---tls-ca-crt value TLS/SSL CA certificate file for client certifications (default: "~/.gotty.ca.crt") [$GOTTY_TLS_CA_CRT] ---index value Custom index.html file [$GOTTY_INDEX] ---title-format value Title format of browser window (default: "{{ .command }}@{{ .hostname }}") [$GOTTY_TITLE_FORMAT] ---reconnect Enable reconnection [$GOTTY_RECONNECT] ---reconnect-time value Time to reconnect (default: 10) [$GOTTY_RECONNECT_TIME] ---max-connection value Maximum connection to gotty (default: 0) [$GOTTY_MAX_CONNECTION] ---once Accept only one client and exit on disconnection [$GOTTY_ONCE] ---timeout value Timeout seconds for waiting a client(0 to disable) (default: 0) [$GOTTY_TIMEOUT] ---permit-arguments Permit clients to send command line arguments in URL (e.g. http://example.com:8080/?arg=AAA&arg=BBB) [$GOTTY_PERMIT_ARGUMENTS] ---width value Static width of the screen, 0(default) means dynamically resize (default: 0) [$GOTTY_WIDTH] ---height value Static height of the screen, 0(default) means dynamically resize (default: 0) [$GOTTY_HEIGHT] ---ws-origin value A regular expression that matches origin URLs to be accepted by WebSocket. No cross origin requests are acceptable by default [$GOTTY_WS_ORIGIN] ---term value Terminal name to use on the browser, one of xterm or hterm. (default: "xterm") [$GOTTY_TERM] ---close-signal value Signal sent to the command process when gotty close it (default: SIGHUP) (default: 1) [$GOTTY_CLOSE_SIGNAL] ---close-timeout value Time in seconds to force kill process after client is disconnected (default: -1) (default: -1) [$GOTTY_CLOSE_TIMEOUT] ---config value Config file path (default: "~/.gotty") [$GOTTY_CONFIG] ---version, -v print the version +@OPTIONS@ ``` ### Config File @@ -202,3 +176,5 @@ The MIT License * Søren L. Hansen ## Contributors + +@CONTRIBUTORS@ \ No newline at end of file diff --git a/README.md.sed b/README.md.sed new file mode 100644 index 0000000..33e8dbf --- /dev/null +++ b/README.md.sed @@ -0,0 +1,8 @@ +/@OPTIONS@/ { + r options.txt.tmp + d +} +/@CONTRIBUTORS@/ { + r contributors.txt.tmp + d +} \ No newline at end of file