{"id":18119552,"url":"https://github.com/dotproto/nah","last_synced_at":"2025-04-06T11:17:48.216Z","repository":{"id":4043412,"uuid":"5145134","full_name":"dotproto/nah","owner":"dotproto","description":"Node argument handler","archived":false,"fork":false,"pushed_at":"2012-07-26T05:39:15.000Z","size":100,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T22:05:04.733Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dotproto.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-07-22T21:57:13.000Z","updated_at":"2024-02-14T01:41:31.000Z","dependencies_parsed_at":"2022-09-12T08:11:40.461Z","dependency_job_id":null,"html_url":"https://github.com/dotproto/nah","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotproto%2Fnah","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotproto%2Fnah/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotproto%2Fnah/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotproto%2Fnah/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotproto","download_url":"https://codeload.github.com/dotproto/nah/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247471522,"owners_count":20944158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-01T05:16:08.489Z","updated_at":"2025-04-06T11:17:48.189Z","avatar_url":"https://github.com/dotproto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e Nah: you could wirte your own argument handler, but why?\n\n*Nah* is a simple command line argument/flag/parameter handler interface for Node.js.\n\nI created *Nah* as a personal learning excersize, but  hopefully others will\nfind it useful. I fully intend to make as robust as reasonably possible.\n\n# Goal\n\nSimplify working with command line parameters. Allow Node.js scripts to access\ncommand line parameters via objects rather than trying to parse [process.argv]\n(http://nodejs.org/docs/latest/api/process.html#process_process_argv).\n\n# Argument definitions\n\nFor each argument, the clients must provide the following information:\n\n* namereq    - boolean: is the name required? (true false)\n* parseorder - parsing order of unnamed args - lower numbers first, cannot be below 0.\n\t* If the name isn't required and praseorder isn't specified, unordered args\n\t  will after ordered args and appear in the order they are defined by the client.\n* full       - full name of the arg (e.g. --wake-on-timestamp)\n* short      - short name of the arg (e.g. -w)\n* req        - boolean: if the caller must supply the arg (true [false])\n* userval    - boolean: if the arg takes a user-supplied value ([true] false)\n\t* Args w/o userval are treated as Booleans with {unset:false,default:true}\n* valreq     - boolean: if the caller must provide a value when arg is supplied (true [false])\n* type       - type of data expected ([boolean], integer, float, string, character, etc.)\n* default    - value if the caller supplies the arg without a value\n* unset      - value if the caller doesn't supply the arg (same as default if not provided)\n\n# Parameter specification schemes\n\n## Basic flags\n\n*Naw* must support Windows and *Nix style syntax.\n\n     Win: /help /? /debug  /silent\n    *nix: --help  --debug --silent\n\n## Shorthand\n\nWindows and *Nix have different shorthand syntax styles.\n\n**Basic* Windows* shorthand is a slash (/) immediately followed by the shorthand\ncommand name. Note that this is virtually identcal to Windows' standard\nstynax.\n\n**Multiple Windows** shortand commands follow the above syntax rules. Callers\nMAY provide a space between commands. The slash (/) between commands MUST be\npresent.\n\n\t  Win: del /q /s\n\t  Win: del /q/s    // Supported by Windows, but toally weird\n\t  Win: del /qs     // Not supported by Winodws, but useful\n\n**Basic \\*Nix** shorthand commands begin with a single dash (-) as compared to\nthe standard double dash (--) and are immdiately followed by a single-\ncharacter command identifier.\n\n** Multiple \\*Nix** shorthand commands may be provided using two different\nschemes. First, multiple commands can be specified using the basic shorthand\nsyntax with a space ( ) between each basic command. Second, multiple commands\ncan be specified by providing a single dash (-) immediatley followed by a\nstring of single-character command identifiers. Both syntaxes achieve the same\nresult.\n\n\t *nix: -h -d -s\n\t *nix: -hds\n\n## Operations on multiple entities\n\nCommand line arguments may appear in any order. *Nah* must be able to handle\narbitrary values placed outside the scope of a given argument. It must also\nproperly support arguments that do not take values immeidately followed by\nan arbitrary value.\n\n\t  Win: del [arg] File-A [arg] File-B [arg]\n\t *nix: rm  [arg] File-A [arg] File-B [arg]\n\n## Parameter with value\n\nWindows and *Nix use different syntaxes for \n\nWindows uses a colon to seperate argument and value.\n\n\t  Win: xcopy /d:10-24-12  \n\n*Nix* uses two patterns to seperate argument and value: an equals character (=)\nor a space ( ).\n\n\t *nix: rm    --interactive=once\n\n# Brainstorming\n\nClients will want/need to \n\n* Specify valid flags\n* Set default flag values\n* Interact with your args as objects, not as strings\n* *(are these the same?)*\n\t* Read multiple values for a single arg name.\n\t* Easy handling of multiple values for a single arg?\n\t\te.g. app.js --file-list=head.txt,shoulders.txt,knees.txt,toes.txt\n* Let users pass in JSON obojects. (nice idea, I'm not looking forward to implementing it)\n\n\t\t// e.g.\n\t\t{1:\"fred.xsl\",2:\"bob.txt\"}","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotproto%2Fnah","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotproto%2Fnah","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotproto%2Fnah/lists"}