cmd

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2017 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "readme [url]",
	Short: "View github readme files from the terminal",
	Long: `Parse and view github readme files in the terminal without having to go to a browser
url should be in the form of username/repository on github`,

	Run: func(cmd *cobra.Command, args []string) {
		switch {
		case len(args) != 1:
			cmd.Help()
		case !strings.Contains(args[0], "/"):
			cmd.Help()
		default:
			Readme(args)
		}
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func EnableColors

func EnableColors()

EnableColors causes the colors to be enabled by default. The color library usually tests to see if the stdout is a terminal first and disables them if not. With colors always enabled, the user can pipe to `less -R` and still get color output

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func PrintInlineCode

func PrintInlineCode(s string)

PrintInlineCode prints when there is code in between backticks (`code`)

func Readme

func Readme(s []string)

Readme gets and prints the file to the terminal

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL