cliutils

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(arg string, v interface{}) error

Parse takes a string of comma-separated k=v pairs and parses it to a struct

For example the string "name=Titanic,year=1997" could be parsed into a struct like:

type Film struct {
	Name   string `arg:"name"`
	Year   int    `arg:"year"`
	Origin string `arg:"origin,Hollywood"
}

Note that no "origin" was specified, so it will be set to the default "Hollywood". If no default value is given, the argument is required. Unused arguments are treated as errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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