{"id":44638989,"url":"https://github.com/nickwells/param.mod","last_synced_at":"2026-02-14T18:08:41.202Z","repository":{"id":57487431,"uuid":"164491724","full_name":"nickwells/param.mod","owner":"nickwells","description":"This provides parameter setting and value checking.","archived":false,"fork":false,"pushed_at":"2025-12-13T23:01:02.000Z","size":1096,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-15T18:54:33.997Z","etag":null,"topics":["cli","flags","go","go-package","golang","golang-package","parameter","params","params-parser"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nickwells.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-01-07T20:37:59.000Z","updated_at":"2025-12-13T23:01:05.000Z","dependencies_parsed_at":"2023-12-15T13:43:25.318Z","dependency_job_id":"567bbc03-7322-4d2c-8d25-7db996fcf170","html_url":"https://github.com/nickwells/param.mod","commit_stats":null,"previous_names":[],"tags_count":132,"template":false,"template_full_name":null,"purl":"pkg:github/nickwells/param.mod","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickwells%2Fparam.mod","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickwells%2Fparam.mod/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickwells%2Fparam.mod/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickwells%2Fparam.mod/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickwells","download_url":"https://codeload.github.com/nickwells/param.mod/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickwells%2Fparam.mod/sbom","scorecard":{"id":685634,"data":{"date":"2025-08-11","repo":{"name":"github.com/nickwells/param.mod","commit":"bedf0d7adaa32747a71acabc70557be0c58ba930"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":10,"reason":"12 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T00:42:29.843Z","repository_id":57487431,"created_at":"2025-08-22T00:42:29.843Z","updated_at":"2025-08-22T00:42:29.843Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29452218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","flags","go","go-package","golang","golang-package","parameter","params","params-parser"],"created_at":"2026-02-14T18:08:40.575Z","updated_at":"2026-02-14T18:08:41.189Z","avatar_url":"https://github.com/nickwells.png","language":"Go","readme":"\u003c!-- Code generated by mkbadge; DO NOT EDIT. START --\u003e\n[![go.dev reference](https://img.shields.io/badge/go.dev-reference-green?logo=go)](https://pkg.go.dev/mod/github.com/nickwells/param.mod/v6)\n[![Go Report Card](https://goreportcard.com/badge/github.com/nickwells/param.mod/v6)](https://goreportcard.com/report/github.com/nickwells/param.mod/v6)\n![GitHub License](https://img.shields.io/github/license/nickwells/param.mod)\n\u003c!-- Code generated by mkbadge; DO NOT EDIT. END --\u003e\n\n# param\nThis provides parameter setting and value checking.\n\nIt differs from other similar packages in that it offers lots of control over\nwhat values are allowed. You can check the value of individual parameters and\nalso check for invalid combinations of parameters. The intention is that once\nparameter parsing is complete you can be sure that the parameters have\nlegitimate values. The benefit of this approach is that you separate out the\nparameter validation from the body of the code and you don't need those\nchecks to be scattered throughout the rest of your code. This means that the\nparameter validation is all in one place so it is easier to confirm that all\nthe necessary checks are being done. Also, early detection of problems allows\nthe problem to be reported with a lot more context showing where the user\nmade the configuration error.\n\nParameters can be set not only through the command line but also, optionally,\nthrough parameter files and environment variables.\n\nYou should use the latest version of this module. Old versions are not\nmaintained and bugs are not fixed in them.\n\n\n## How to use the param package\n\nDefine a `param.PSet` and populate it, then parse the command line arguments.\n\nHere is the simplest possible way of using it:\n\n```go\nfunc main() {\n\tvar who = \"World!\"\n\tps := paramset.NewOrPanic()\n\tps.Add(\"who\", psetter.String{Value: \u0026who}, \"who to greet\")\n\tps.Parse()\n\tfmt.Println(\"Hello,\", who)\n}\n```\nand here's a slightly bigger example using some of the common features\n\n```go\nvar param1 int\nvar param2 bool\n\nfunc main() {\n\tps := paramset.NewOrPanic(addParams,\n\t\tparam.SetProgramDescription(\"this program will do cool stuff\"))\n\tps.Parse()\n```\n\nThe work is done mostly in the addParams function which should take a pointer to a\n`param.PSet` and return an error if anything goes wrong.\n\n```go\nfunc addParams(ps *param.PSet) error {\n\tps.Add(\"param-1\",\n\t\tpsetter.Int[int]{\n\t\t\tValue:  \u0026param1,\n\t\t\tChecks: []check.ValCk[int]{check.ValLT[int](42)},\n\t\t},\n\t\t\"this sets the value of param1\",\n\t\tparam.AltNames(\"p1\", \"p-1\"))\n\t\t\n\tps.Add(\"param-2\", psetter.Bool{Value: \u0026param2},\n\t\t\"this sets the value of param2\")\n\t\t\n\treturn nil\n}\n```\n\nThis illustrates a simple use of the param package with a simple boolean flag\nand an integer which is checked to ensure it's less than 42. You can specify\nthe behaviour much more precisely if you want.\n\nThe recommended way of writing your code is to have a paramset.go file which\ncontains just a makeParamSet function. This should take a pointer to a Prog\nstruct (which is unique to the program). The Prog struct members should be\nset by the parameters (so you don't have any global variables) and the\nmakeParamSet func will panic (due to the paramset.NewOrPanic call) and so can\nbe tested by calling it from within a panic-safe wrapper.\n\nAdditionally you can have positional parameters as well as named\nparameters. These must come at the front of the supplied parameters and can\nonly be set through the command line.\n\nYou can specify a terminal parameter (by default `--`) and the remaining\nparameters will be available for further processing without being parsed. If\nyou intend for your users to supply additional parameters you must set a\nhandler function using the `PSet.SetRemHandler` method. The handler can\neither process the additional arguments or else, if `param.NullRemHandler`\nhas been given, you can process the remainder after `PSet.Parse` has\ncompleted. If you haven't done either of these things the default behaviour\nis to report the additional arguments as an error.\n\n## Setters\nEach parameter is associated with a `Setter` which sets the parameter value\neither from the associated value (the next program argument) or directly if\nthe parameter expects no following value. There are numerous setters\npredefined and many of these allow you to specify additional checks on the\nparameter value. See the `psetter` package for a full list. Additionally\nyou can write your own setter which you can use to populate some bespoke\nstructure. The setters and associated checks provide much of the power and\nflexibility of the `param` package. Various types and functions are\navailable to help you write your own setter but you should only need to do\nthis if there is not already an existing setter so check the pre-existing\nsetters first.\n\n## Actions\nEach parameter can have a list of associated action functions which will be\ncalled after the value has been set. These action functions can perform\nadditional checks on the parameter or can be used for parameter-specific\nactions. Various standard actions are provided in the `paction` package.\n\n## Attributes\nYou can set additional attributes on parameters to control:\n- whether a parameter can only be used on the command line\n- whether the parameter must be set\n- whether it can be changed once set. This could be useful to set a value in\n  a system-wide file and prevent accidental changes from the system default\n- hiding the parameter from the standard help message. This is used by many\n  of the standard parameters to avoid showing repeatedly the same, well-known\n  parameters. You can use it to hide some more obscure options from the\n  standard help message.\n\n## Standard parameters\nThe default behaviour of the package will add some standard\nparameters. These allow the user to see a help message which is automatically\ngenerated from the parameters added above. This can be in varying levels of\ndetail. If you just pass the `-help` param you will get the standard help\nmessage but the `-help-full` parameter shows any hidden parameters and the\n`-help-short` parameter gives a help message in summary form.\n\nAdditionally the standard parameters enable you to\n- examine where parameters have been set which can be useful if you have\n  several parameter files and environment prefixes\n- list parameters from parameter files which have not been recognised\n  (parameters from the command line must be recognised). Again, this can be\n  useful to identify misspelled entries in parameter files\n- choose to exit after parsing which can be useful when debugging the\n  parameters you have added\n- choose to not exit on errors which can be useful in emergencies if your\n  command is being too strict.\n- choose to not print the errors which might be useful in a circumstance\n  where the exit status is all that is needed\n- control the level of detail in the help message with the help-full and\n  help-summary parameters.\n- precisely control which groups of parameters you want to see or hide in\n  help messages.\n- provide a file holding paramters to be parsed\n\n## The help message\nThe standard help message generated if the user passes the -help parameter\nwill show the program description and the non-hidden parameters. For each\nparameter it will show:\n* the parameter description\n* any alternative names\n* the initial value of the parameter\n* the allowed values and whether there are any additional constraints\n\nAdditionally if there are any configuration files that have been specified\n(use the `SetConfigFile` and `AddConfigFile` functions on the `PSet`) or\nany environment variable prefixes have been given (use the `SetEnvPrefix` and\n`AddEnvPrefix` functions on the `PSet`) these will be reported at the end\nof the help message.\n\n## Parameter Groups\nParameters can be grouped together so that they are reported together rather\nthan in alphabetical order. This is to allow logically related parameters to\nbe reported together and shown or hidden together. The standard parameters\noffer a way of showing the help message just for specified parameter\ngroups. You can add a description to be shown for the parameter group and you\ncan have configuration files and environment variable prefixes which are\nspecific to just the parameters in the group (use corresponding `SetGroup...`\nand `AddGroup...` functions on the `PSet`).\n\n## Parameter files\nParameter files are intended to allow common parameters to be set once in the\nfile and avoid the need to repeat them each time a command is run. The files\ncan include other files through an `@include` directive and comments can be\nadded with a leading `#`. The values of the include directives and comment\nintroducers can be changed programmatically or they can be disallowed. White\nspace and blank lines are ignored and the parameters must not have their\nleading `-` or `--` characters.\n\nFiles containing parameters can contain parameters which are not intended for\nthe current program, this is to allow a single parameter file to be used by a\ncollection of binaries; unrecognised parameters are silently\nignored. Alternatively, if you prefix a parameter with a program name and a `/`\nthen the parameter will only be used if the program name matches that of the\nrunning program. In this latter case the parameter must be recognised and it\nis an error if it is not.\n\nNote that having parameter files, especially with the ability to include\nother files can cause problems. For instance, it can be confusing to see\nwhere a parameter has been set.  In order to help use this feature the\nstandard parameter `params-show-where-set` can be given which will show all\nthe places where a parameter has been set.\n\nSimilarly with unrecognised parameters being silently ignored so as to allow\nother programs parameters to be present in the file a typo may easily go\nunnoticed. In order to help use this feature the standard parameter\n`params-show-unused` can be given which will show all the unused parameters\nallowing you to identify any misspelled entries.\n\n## Environment variables\nYou can specify that a program can initialise the parameters from environment\nvariables as well. You must specify the prefix to be used and then the\nenvironment will be checked for variables having that prefix and with the\nremainder of the variable matching the parameter name. The parameter name is\nmodified to change dashes to underscores when checking environment variables.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickwells%2Fparam.mod","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickwells%2Fparam.mod","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickwells%2Fparam.mod/lists"}