cmd

package
v0.0.0-...-7320205 Latest Latest
Warning

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

Go to latest
Published: May 4, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "ds",
	Short: "A swiss army tool for markup languages like json, yaml, and toml.",
	Long: `A swiss army tool for markup languages like json, yaml, and toml.

ds will try to figure out automagically what the type of any file passed in
is. It uses a couple methods to do this. First, the file extension:
  - .yaml/.yml: YAML
  - .toml: TOML
  - .json: JSON
  - .xml:  XML

If the file extension is unknown, it will try a series of parsers until one
works (in this order):
  1. JSON
  2. TOML
  3. XML
  3. YAML


If it fails, or you want to be extra sure it's using the right parser, you can 
also specify the file type. These will override the file name, and supported
values are:
  - yaml/yml
  - json
  - toml
  - xml
`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		if verbose {
			logrus.SetLevel(logrus.DebugLevel)
		} else {
			logrus.SetLevel(logrus.FatalLevel)
		}

		if compact {
			for _, parser := range parsers {
				if parser.lang == JSON {
					parser.marshal = json.Marshal
				}
			}
		}
	},
}

Functions

This section is empty.

Types

type Language

type Language int
const (
	Any Language = iota
	JSON
	TOML
	XML
	YAML
)

func (Language) String

func (i Language) String() string

Jump to

Keyboard shortcuts

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