dimiro1 / banner

An easy way to add useful startup banners into your Go applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

banner is overriding other command line flags

bilalcaliskan opened this issue · comments

Hello,

My example application has couple of command line flags which i have parsed with pflag. But whenever i use github.com/dimiro1/banner/autoload it overrides my current flags and prints below when i run my binary with -h . I would expect instead of overriding my flags, appending to them actually.

Below is my application's expected command line flags:

$ ./main --help
Usage of ./main:
      --createUserUrl string   url of the user creation on Oreilly API (default "https://learning.oreilly.com/api/v1/user/")
      --emailDomain string     usable domain for creating trial account, it should be a valid domain (default "jentrix.com")
      --length int             length of the random generated username and password (default 12)

And this is the flags when i use banner, as you see, my application's flags are missing:

$ ./main --help
Usage of ./main:
  -ansi
        ansi colors enabled? (default true)
  -banner string
        banner.txt file (default "banner.txt")
  -show-banner
        print the banner? (default true)

I would expect something like that:

$ ./main --help
Usage of ./main:
      --createUserUrl string   url of the user creation on Oreilly API (default "https://learning.oreilly.com/api/v1/user/")
      --emailDomain string     usable domain for creating trial account, it should be a valid domain (default "jentrix.com")
      --length int              length of the random generated username and password (default 12)
      -ansi                       ansi colors enabled? (default true)
      -banner string        banner.txt file (default "banner.txt")
      -show-banner        print the banner? (default true)

Same situation repeats even if i use go's default flag package instead of pflag.

i have moved my master branch code to banner branch and removed banner from master branch, if you like to investigate my code.

I have solved that problem by using Banner API as shown here. Somehow i could not make it work with autoload package.