mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
build: Generate CLI docs in GHA (#236)
* build: Generate CLI docs in GHA * fix: Move no-tty logic outside cobra definitions
This commit is contained in:
@@ -36,6 +36,12 @@ jobs:
|
|||||||
git diff --exit-code ||
|
git diff --exit-code ||
|
||||||
(echo "go.mod or go.sum has changed. Please run 'go mod tidy' and commit the changes." && exit 1)
|
(echo "go.mod or go.sum has changed. Please run 'go mod tidy' and commit the changes." && exit 1)
|
||||||
|
|
||||||
|
- name: Generate docs
|
||||||
|
run: |
|
||||||
|
make cli-docs
|
||||||
|
git diff --exit-code ||
|
||||||
|
(echo "Documentation is out of date. Please run 'make cli-docs' and commit the changes." && exit 1)
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
make ucind-image
|
make ucind-image
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ If the service has multiple replicas and no container ID is specified, the comma
|
|||||||
|
|
||||||
execCmd.Flags().BoolVarP(&opts.detach, "detach", "d", false, "Detached mode: run command in the background")
|
execCmd.Flags().BoolVarP(&opts.detach, "detach", "d", false, "Detached mode: run command in the background")
|
||||||
|
|
||||||
execCmd.Flags().BoolVarP(&opts.noTty, "no-tty", "T", !cli.IsStdoutTerminal(),
|
execCmd.Flags().BoolVarP(&opts.noTty, "no-tty", "T", false,
|
||||||
"Disable pseudo-TTY allocation. By default 'uc exec' allocates a TTY when connected to a terminal.")
|
"Disable pseudo-TTY allocation. By default 'uc exec' allocates a TTY when connected to a terminal.")
|
||||||
|
|
||||||
// Keep "-i" and "-t" flags hidden for compatibility with docker exec
|
// Keep "-i" and "-t" flags hidden for compatibility with docker exec
|
||||||
@@ -82,6 +82,11 @@ If the service has multiple replicas and no container ID is specified, the comma
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runExec(ctx context.Context, uncli *cli.CLI, serviceName string, command []string, opts execCliOptions) error {
|
func runExec(ctx context.Context, uncli *cli.CLI, serviceName string, command []string, opts execCliOptions) error {
|
||||||
|
// Disable TTY allocation if not connected to a terminal
|
||||||
|
if !cli.IsStdoutTerminal() {
|
||||||
|
opts.noTty = true
|
||||||
|
}
|
||||||
|
|
||||||
if !opts.detach {
|
if !opts.detach {
|
||||||
// Check if we're trying to attach to a TTY from a non-TTY client, e.g.
|
// Check if we're trying to attach to a TTY from a non-TTY client, e.g.
|
||||||
// when doing an 'cmd | uc exec ...'
|
// when doing an 'cmd | uc exec ...'
|
||||||
|
|||||||
Reference in New Issue
Block a user