gh-screensaver icon indicating copy to clipboard operation
gh-screensaver copied to clipboard

Spacing issue in output

Open leereilly opened this issue 4 years ago • 3 comments

Noticed that marquee is offset here:

$ gh screensaver -l   
fireworks
         marquee

Similarly, when I pass in the incorrect flag i.e. -list instead of --list:

$ gh screensaver -list
Error: unknown shorthand flag: 'i' in -ist
                                          Usage:
                                                  screensaver [flags]

                                                                     Flags:
                                                                             -h, --help           help for screensaver
                                                                                                                        -l, --list           List available screensavers and exit
   -R, --repo string    Repository to contribute to
                                                     -s, --saver string   Screensaver to play

                                                                                             unknown shorthand flag: 'i' in -ist

Possibly related to the error log output in #2.

leereilly avatar Aug 18 '21 19:08 leereilly

So this behavior is now gone. Is it possible some gh / gh extension script altered something in my shell session? 🤔

leereilly avatar Aug 18 '21 19:08 leereilly

Aaaand it's back. How to recreate with gh 1.14.0-62-g8a563599 and this extension as of 4ab769413d7abedacf921658c753097d45263f98:

  1. Navigate to a repo
  2. Type gh and see the output nicely formatted
  3. Type gh screensaver -s foo and you'll see an error message
  4. Type gh (or any other command) and you'll see the weird spacing issue

$ cd github/cli 

$ gh 
Work seamlessly with GitHub from the command line.

USAGE
  gh <command> <subcommand> [flags]

CORE COMMANDS
  browse:     Open the repository in the browser
  gist:       Manage gists
  issue:      Manage issues
  pr:         Manage pull requests
  release:    Manage GitHub releases
  repo:       Create, clone, fork, and view repositories

ACTIONS COMMANDS
  actions:    Learn about working with GitHub actions
  run:        View details about workflow runs
  workflow:   View details about GitHub Actions workflows

ADDITIONAL COMMANDS
  alias:      Create command shortcuts
  api:        Make an authenticated GitHub API request
  auth:       Login, logout, and refresh your authentication
  completion: Generate shell completion scripts
  config:     Manage configuration for gh
  help:       Help about any command
  secret:     Manage GitHub secrets
  ssh-key:    Manage SSH keys

EXTENSION COMMANDS
  branch
  contribute
  screensaver
  user-status

FLAGS
  --help      Show help for command
  --version   Show gh version

EXAMPLES
  $ gh issue create
  $ gh repo clone cli/cli
  $ gh pr checkout 321

ENVIRONMENT VARIABLES
  See 'gh help environment' for the list of supported environment variables.

LEARN MORE
  Use 'gh <command> <subcommand> --help' for more information about a command.
  Read the manual at https://cli.github.com/manual

FEEDBACK
  Open an issue using 'gh issue create -R github.com/cli/cli'

gh screensaver -s foo

panic: runtime error: invalid memory address or nil pointer dereference
                                                                       [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x11e3abd]

                                                                                                                                              goroutine 1 [running]:
                                                                                                                                                                    main.runScreensaver(0x7ffeefbffc1e, 0x3, 0xc000239006, 0x7, 0x0, 0x0, 0x0, 0x0, 0x12fae70, 0xc00021e240, ...)
                                                                                                        /Users/leereilly/.local/share/gh/extensions/gh-screensaver/main.go:31 +0x17d
    main.rootCmd.func1(0xc0001bef00, 0xc0001ac260, 0x0, 0x2, 0x0, 0x0)
                                                                        /Users/leereilly/.local/share/gh/extensions/gh-screensaver/main.go:121 +0x298
                                                                                                                                                     github.com/spf13/cobra.(*Command).execute(0xc0001bef00, 0xc000182190, 0x2, 0x2, 0xc0001bef00, 0xc000182190)
                                                                                        /Users/leereilly/go/pkg/mod/github.com/spf13/[email protected]/command.go:856 +0x472
                                                                                                                                                                       github.com/spf13/cobra.(*Command).ExecuteC(0xc0001bef00, 0xc000000300, 0x200000003, 0xc000000300)
                                                                                                /Users/leereilly/go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x375
                                                                                                                                                                               github.com/spf13/cobra.(*Command).Execute(...)
                                                /Users/leereilly/go/pkg/mod/github.com/spf13/[email protected]/command.go:902
                                                                                                                        main.main()
                                                                                                                                        /Users/leereilly/.local/share/gh/extensions/gh-screensaver/main.go:151 +0x2b

$ gh

         contribute
                     screensaver
                                  user-status

                                             FLAGS
                                                    --help      Show help for command
                                                                                       --version   Show gh version

                                                                                                                  EXAMPLES
                                                                                                                            $ gh issue create
                                                                                                                                               $ gh repo clone cli/cli
                                                                                                                                                                        $ gh pr checkout 321

            ENVIRONMENT VARIABLES
                                   See 'gh help environment' for the list of supported environment variables.

                                                                                                             LEARN MORE
                                                                                                                         Use 'gh <command> <subcommand> --help' for more information about a command.
                       Read the manual at https://cli.github.com/manual

                                                                       FEEDBACK
                                                                                 Open an issue using 'gh issue create -R github.com/cli/cli'

leereilly avatar Aug 18 '21 19:08 leereilly

i think this is fallout from what tcell does to the terminal and I don't know that i can fix it; I can at least minimize the number of panics :)

vilmibm avatar Sep 23 '21 17:09 vilmibm