options

package
v0.0.0-...-2ba7f8e Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

* * Package options implement parse config from a config file and then parse flag * arguments from command line. flags name according to GNU's format which * user "-" with an alphabet for short format, and "--" with a word for long format. * * Users should defeine their own option,like * * type UsersOptions struct { * Host `toml:"host" flag:"host" sflag:"h" default:"127.0.0.1" help:"TCP host for listen." ` * Port `toml:"port" flag:"port" sflag:"p" default:"9053" help:"TCP port for listen."` * } * * czoptions will parse Host and Port from your config file, and then parse them from the * command line with flags(-h for short and --host for long) if they are there. a New method will return an UserOptions * with default value of tag "default" . tag "help" will see in flag's help message * * Note: czoptions will take a flag name "-c" "--config" for config file * and "-h" "--help" for help

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(options interface{}) (err error)

Parse will parse flag and read config file to option with default values

Types

This section is empty.

Jump to

Keyboard shortcuts

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