yaml

package
v0.0.0-...-345b6a2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 12 Imported by: 0

README

yaml

output a pretty yaml

Usage

$ show yaml -h
NAME:
   show yaml - yaml beautify output

USAGE:
   show yaml [command options] [arguments...]

DESCRIPTION:
   display file or remote yaml data, you can display the yaml data you need by specifying the yaml field key,
   if you don’t specify the key, the complete yaml data will be displayed
   eg:
   show yaml --remote https://raw.githubusercontent.com/anqiansong/show/main/.github/workflows/go.yml name
   show yaml --file data.yaml

OPTIONS:
   --remote value, -r value  show yaml from remote
   --file value, -f value    show yaml from file
   --help, -h                show help (default: false)
Example
output pretty yaml data from remote
$ show yaml --remote https://raw.githubusercontent.com/anqiansong/show/main/testdata/data.yaml
code: 0
data:
    user:
        company: ByteDance
        desc: none
        name: keson
msg: ok
specified json key
$ show yaml --remote https://raw.githubusercontent.com/anqiansong/show/main/testdata/data.yaml data.user.name
keson
from file
$ show yaml -f data.yaml
data:
    user:
        age: 30
        name: keson
$ show yaml -f data.yaml data.user
age: 30
name: keson
from linux channel
$ cat data.yaml | show yaml data
user:
    age: 30
    name: keson
$ cat data.yaml | show yaml data.user.name
keson

Documentation

Overview

Package yaml is used to beautify the output of yaml. The yaml data can come from files, networks and linux pipelines, such as: show yaml --file data.yaml data.name means to view the data.name in the data.yaml file, show yaml- -remote https://raw.githubusercontent.com/anqiansong/show/main/testdata/data.yaml data.user.name represents view the name in the data.yaml, echo 'name: foo' | show yaml name represents view the data which key is name.

Index

Constants

This section is empty.

Variables

View Source
var Command = &cli.Command{
	Name:  "yaml",
	Usage: "yaml beautify output",
	Description: "display a file or remote yaml data, you can display the yaml data you need by specifying the yaml field key, \n" +
		"if you don’t specify the key, the complete yaml data will be displayed\n" +
		"eg:\n" +
		"show yaml --remote https://raw.githubusercontent.com/anqiansong/show/main/testdata/data.yaml data.user\n" +
		"show yaml --file data.yaml",
	Action: actionYaml,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "remote",
			Usage:   "show yaml from remote",
			Aliases: []string{"r"},
		},
		&cli.StringFlag{
			Name:    "file",
			Usage:   "show yaml from file",
			Aliases: []string{"f"},
		},
	},
}

Command describes a subcommands in application.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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