Option: a busy optional parameter for golang

Option

option is a busy optional parameter

init

opt := option.New()

set

opt.Set("parameter name", 3.141592)

apply

a := 0.0
opt.Apply("parameter name", &a, 1.1)

clone

otherOpt := opt.Clone()

in function

func Add(opt *option.Option) int {
    a := 0
    b := 0

    opt.Apply("a", &a, 0)
    opt.Apply("b", &b, 0)

    return a + b
}

func main() {
    opt := option.New()
    opt.Set("a", 6)
    opt.Set("b", 8)

    rs := Add(opt)

    fmt.Println(rs)
}
Owner
snowmerak
I am poor and fool
snowmerak
Similar Resources

Command Line Alias Manager and Plugin System - Written in Golang

Command Line Alias Manager and Plugin System - Written in Golang

aly - Command Line Alias Manager and Packager Aly offers the simplest way to manage, share, and obtain command line aliases! Warning: This project is

Jun 16, 2022

💻 PTerm | Pretty Terminal Printer A golang module to print pretty text

💻 PTerm | Pretty Terminal Printer A golang module to print pretty text

✨ PTerm is a modern go module to beautify console output. Featuring charts, progressbars, tables, trees, and many more 🚀 It's completely configurable and 100% cross-platform compatible.

Jan 1, 2023

A collection of terminal-based widgets for richer Golang CLI apps.

A collection of terminal-based widgets for richer Golang CLI apps.

Flinch A collection of terminal-based widgets for richer Golang CLI apps. Ships with a library to build your own widgets/TUIs too. Warning: This modul

Jan 7, 2023

A really basic thread-safe progress bar for Golang applications

A really basic thread-safe progress bar for Golang applications

progressbar A very simple thread-safe progress bar which should work on every OS without problems. I needed a progressbar for croc and everything I tr

Jan 1, 2023

Console progress bar for Golang

Terminal progress bar for Go Installation go get github.com/cheggaaa/pb/v3 Documentation for v1 bar available here Quick start package main import (

Jan 9, 2023

Color package for Go (golang)

Color package for Go (golang)

color Color lets you use colorized outputs in terms of ANSI Escape Codes in Go (Golang). It has support for Windows too! The API can be used in severa

Dec 31, 2022

Golang terminal dashboard

Golang terminal dashboard

termui termui is a cross-platform and fully-customizable terminal dashboard and widget library built on top of termbox-go. It is inspired by blessed-c

Dec 29, 2022

A library for writing system daemons in golang.

A library for writing system daemons in golang.

go-daemon Library for writing system daemons in Go. Now supported only UNIX-based OS (Windows is not supported). But the library was tested only on Li

Dec 29, 2022

Go (golang) package with 70+ configurable terminal spinner/progress indicators.

Go (golang) package with 70+ configurable terminal spinner/progress indicators.

Spinner spinner is a simple package to add a spinner / progress indicator to any terminal application. Examples can be found below as well as full exa

Dec 26, 2022
Related tags
Option container for golang

Option Option provides an Option container which can be used to force some addit

Dec 21, 2021
A simple go program which checks if your websites are running and runs forever (stop it with ctrl+c). It takes two optional arguments, comma separated string with urls and an interval.

uptime A simple go program which checks if your websites are running and runs forever (stop it with ctrl+c). It takes two optional arguments: -interva

Dec 15, 2022
Flag is a simple but powerful command line option parsing library for Go support infinite level subcommand

Flag Flag is a simple but powerful commandline flag parsing library for Go. Documentation Documentation can be found at Godoc Supported features bool

Sep 26, 2022
go command line option parser

go-flags: a go library for parsing command line arguments This library provides similar functionality to the builtin flag library of go, but provides

Jan 4, 2023
A very simple library for interactively selecting an option on a terminal
A very simple library for interactively selecting an option on a terminal

go-choice A very simple library for interactively selecting an option on a terminal Usage package main import ( "fmt" "github.com/TwiN/go-ch

Dec 30, 2021
Argparse for golang. Just because `flag` sucks

Golang argparse Let's be honest -- Go's standard command line arguments parser flag terribly sucks. It cannot come anywhere close to the Python's argp

Dec 28, 2022
Golang library with POSIX-compliant command-line UI (CLI) and Hierarchical-configuration. Better substitute for stdlib flag.
Golang library with POSIX-compliant command-line UI (CLI) and Hierarchical-configuration. Better substitute for stdlib flag.

cmdr cmdr is a POSIX-compliant, command-line UI (CLI) library in Golang. It is a getopt-like parser of command-line options, be compatible with the ge

Oct 28, 2022
CONTRIBUTIONS ONLY: A Go (golang) command line and flag parser

CONTRIBUTIONS ONLY What does this mean? I do not have time to fix issues myself. The only way fixes or new features will be added is by people submitt

Dec 29, 2022
A CLI tool implemented by Golang to manage `CloudComb` resource

CloudComb CLI tool: comb Get Started comb is a CLI tool for manage resources in CloudComb base on cloudcomb-go-sdk. Support Mac, Linux and Windows. We

Jan 4, 2021
Automatically generate Go (golang) struct definitions from example JSON

gojson gojson generates go struct definitions from json or yaml documents. Example $ curl -s https://api.github.com/repos/chimeracoder/gojson | gojson

Jan 1, 2023