![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
github.com/dshess/getopt
getopt implements command-line flag parsing. This is abandonware, as I replaced it with [github.com/dshess/Opts], which uses descriptor functions instead of parsing descriptor strings, because it is cleaner.
Options-handling modeled on Perl's Getopt::Long. To handle a string, an int, and a flag:
data := "file.dat"
length := 24
var verbose bool
err := GetOSOptions(
"length=i", &length, // numeric
"files=s", &data, // string
"verbose", &verbose, // flag
)
if err != nil {
log.Fatal("Error in command-line arguments:", err)
}
If the command is passed "--files=hello.world --length 10 --verbose rest", then after GetOSOptions, data will be "hello.world", length will be 10, verbose will be true, and os.Args[1:] will be []string{"rest"}.
This code only handles --option style of options. "--" ends option processing. Boolean options can only be negatable or simple, with no parameters (so --option or --nooption). Int, Float, or String options can be provided as --option=value or --option value. Optional options deliver the provided value if the option is seen with no further arguments, or if the next argument itself looks like an option.
The option list must have pairs of values, a string descriptor and a pointer to someplace to store values. It is an error if the pointed-to type is not compatible with the descriptor. It is also an error if multiple pointers to the same variable are provided.
Descriptors in the style of "value=s" are more in the style of Getopt::Long, because Perl's typing is different than Go's. Perl can infer array versus scalar, but not int versus string. Go can infer int vs string, so it may make sense to not use typing in the descriptor. OTOH, the descriptor makes the type clear in context.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.