diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-13 22:23:54 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-13 22:23:54 -0800 |
| commit | 860e1ecb570bda229b6a64fef905923898e0f832 (patch) | |
| tree | 261c4781766e3d6d273809625cc4e364ab07b925 /main.go | |
| parent | 47c43577ead8721008b858232511b2f65e0ed574 (diff) | |
| download | neko-860e1ecb570bda229b6a64fef905923898e0f832.tar.gz neko-860e1ecb570bda229b6a64fef905923898e0f832.tar.bz2 neko-860e1ecb570bda229b6a64fef905923898e0f832.zip | |
Audit and reduce Go dependencies: replace go.rice with embed, pflag with flag
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 47 |
1 files changed, 32 insertions, 15 deletions
@@ -11,9 +11,10 @@ import ( "adammathes.com/neko/models" "adammathes.com/neko/models/feed" + "flag" + "adammathes.com/neko/vlog" "adammathes.com/neko/web" - flag "github.com/ogier/pflag" ) var Version, Build string @@ -33,24 +34,40 @@ func Run(args []string) error { f := flag.NewFlagSet("neko", flag.ContinueOnError) // config file - f.StringVarP(&configFile, "config", "c", "", "read configuration from file") + f.StringVar(&configFile, "config", "", "read configuration from file") + f.StringVar(&configFile, "c", "", "read configuration from file (short)") + + // commands + f.BoolVar(&help, "help", false, "display help") + f.BoolVar(&help, "h", false, "display help (short)") + + f.BoolVar(&update, "update", false, "fetch feeds and store new items") + f.BoolVar(&update, "u", false, "fetch feeds and store new items (short)") + + f.StringVar(&newFeed, "add", "", "add the feed at URL") + f.StringVar(&newFeed, "a", "", "add the feed at URL (short)") + + f.StringVar(&export, "export", "", "export feed: text, opml, html, json") + f.StringVar(&export, "x", "", "export feed (short)") + + // options + f.StringVar(&dbfile, "database", "", "sqlite database file") + f.StringVar(&dbfile, "d", "", "sqlite database file (short)") + + f.IntVar(&port, "http", 0, "HTTP port to serve on") + f.IntVar(&port, "s", 0, "HTTP port to serve on (short)") - // commands -- no command runs the web server - f.BoolVarP(&help, "help", "h", false, "print usage information") - f.BoolVarP(&update, "update", "u", false, "fetch feeds and store new items") - f.StringVarP(&newFeed, "add", "a", "", "add the feed at URL `http://example.com/rss.xml`") - f.StringVarP(&export, "export", "x", "", "export feed. format required: text, opml, html, or json") + f.IntVar(&minutes, "minutes", 0, "minutes between crawling feeds") + f.IntVar(&minutes, "m", 0, "minutes between crawling feeds (short)") - // options -- defaults are set in config/main.go and overridden by cmd line - f.StringVarP(&dbfile, "database", "d", "", "sqlite database file") - f.IntVarP(&port, "http", "s", 0, "HTTP port to serve on") - f.IntVarP(&minutes, "minutes", "m", 0, "minutes between crawling feeds") - f.BoolVarP(&proxyImages, "imageproxy", "i", false, "rewrite and proxy all image requests for privacy (experimental)") + f.BoolVar(&proxyImages, "imageproxy", false, "rewrite and proxy all image requests") + f.BoolVar(&proxyImages, "i", false, "rewrite and proxy all image requests (short)") - f.BoolVarP(&verbose, "verbose", "v", false, "verbose output") + f.BoolVar(&verbose, "verbose", false, "verbose output") + f.BoolVar(&verbose, "v", false, "verbose output (short)") - // passwords on command line are bad, you should use the config file - f.StringVarP(&password, "password", "p", "", "password to access web interface") + f.StringVar(&password, "password", "", "password for web interface") + f.StringVar(&password, "p", "", "password for web interface (short)") f.Usage = func() { fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0]) |
