Some tools, I frequently use.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.6 KiB

// ebkTools/cli project ebkTools.go
/**
= Creative Commons Lizenzvertrag =
ebktools von der archium GmbH, Gera ist lizenziert unter einer Creative Commons Namensnennung - Nicht kommerziell - Keine Bearbeitungen 4.0 International Lizenz. (http://creativecommons.org/licenses/by-nc-nd/4.0/deed.de)
Individuelle über diese Lizenz hinausgehende Berechtigungen können Sie unter https://archium.org erhalten.
= Creative Commons License =
ebktools by archium GmbH, Gera is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. (http://creativecommons.org/licenses/by-nc-nd/4.0/)
Individual permissions beyond the scope of this license may be available at https://archium.org.
**/
package cli
import "os"
//type universal interface{}
func MapCLIArguments() *map[string]string {
cliAguments := os.Args[1:] //without the program path itself
//var cliAgumentsMapped map[string]universal = make(map[string]universal)
var cliAgumentsMapped map[string]string = make(map[string]string)
//Dismantle list of command line arguments
for key, value := range cliAguments {
if value[0:1] == "-" {
if len(cliAguments) > key+1 && cliAguments[key+1][0:1] != "-" {
cliAgumentsMapped[cliAguments[key]] = cliAguments[key+1] //; fmt.Printf("Argument mit Wert %v = %v\n", cliAguments[key], cliAguments[key+1])
} else {
//cliAgumentsMapped[cliAguments[key]] = true
cliAgumentsMapped[cliAguments[key]] = "" //; fmt.Printf("Argument ohne Wert %v\n", cliAguments[key])
}
}
}
return &cliAgumentsMapped // test it with: fmt.Println((*cli.MapCLIArguments())["-a"])
}