Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "bcat", Short: "pipe to browser utility", Long: `Usage: bcat [-htp] [-a] [-b <browser>] [-T <title>] [<file>]... Pipe to browser utility. Read standard input, possibly one or more <file>s, and write concatenated / formatted output to browser. When invoked as btee, also write all input back to standard output. Display options: -b, --browser=<browser> open <browser> instead of system default browser -T, --title=<text> use <text> as the browser title -a, --ansi convert ANSI (color) escape sequences to HTML Input format (auto detected by default): --html input is already HTML encoded, doc or fragment --text input is unencoded text Misc options: -p, --persist serve until interrupted, allowing reload -d, --debug enable verbose debug logging on stderr`, Run: func(cmd *cobra.Command, args []string) { rc, err := bcatlib.NewReaderCollection(args) if err != nil { fmt.Fprintf(os.Stderr, "error: %s\n", err) } ch := rc.MakeFilterableChan() if options.Ansi { options.Html = true ch = bcatlib.TextFilter(ch) } done, url := bcatlib.ServerEndpoint(ch) browserCommand := viper.GetString("BCAT_COMMAND") b, err := bcatlib.NewBrowser(options.Browser, browserCommand) if err != nil { fmt.Fprintf(os.Stderr, "error: %s\n", err) } if err := b.Open(url); err != nil { fmt.Fprintf(os.Stderr, "error: %s\n", err) } fmt.Println(url) <-done }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.