{"id":18284479,"url":"https://github.com/pplu/argv-struct","last_synced_at":"2026-03-16T03:34:30.689Z","repository":{"id":26435296,"uuid":"29885958","full_name":"pplu/ARGV-Struct","owner":"pplu","description":"Parse complex data structures passed in ARGV","archived":false,"fork":false,"pushed_at":"2018-11-28T22:02:14.000Z","size":19,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T07:33:30.056Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Perl","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/pplu.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","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":"2015-01-26T22:51:02.000Z","updated_at":"2018-11-28T22:01:55.000Z","dependencies_parsed_at":"2022-07-27T08:18:44.976Z","dependency_job_id":null,"html_url":"https://github.com/pplu/ARGV-Struct","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/pplu/ARGV-Struct","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplu%2FARGV-Struct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplu%2FARGV-Struct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplu%2FARGV-Struct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplu%2FARGV-Struct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pplu","download_url":"https://codeload.github.com/pplu/ARGV-Struct/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplu%2FARGV-Struct/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270041267,"owners_count":24516808,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-05T13:13:41.003Z","updated_at":"2026-03-16T03:34:30.623Z","avatar_url":"https://github.com/pplu.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nARGV::Struct - Parse complex data structures passed in ARGV\n\n# SYNOPSIS\n\n    use ARGV::Struct;\n    my $struct = ARGV::Struct-\u003enew-\u003eparse;\n\n# DESCRIPTION\n\nHave you ever felt that you need something different than Getopt?\n\nAre you tired of shoehorning Getopt style arguments into your commandline scripts?\n\nAre you trying to express complex datastructures via command line?\n\nthen ARGV::Struct is for you!\n\nIt's designed so the users of your command line utilities won't hate you when things\nget complex.\n\n# THE PAIN\n\nI've had to use some command-line utilities that had to do creative stuff to transmit\ndeeply nested arguments, or datastructure-like information. Here are some strategies that\nI've found over time: \n\n## Complex arguments codified as JSON\n\nJSON is horrible for the command line because you have to escape the quotes. It's a nightmare.\n\n    command --complex_arg \"{\\\"key1\\\":\\\"value1\\\",\\\"key2\\\":\\\"value2\\\"}\"\n\n## Arguments encoded via some custom scheme\n\nThese schemes fail when you have to make values complex (lists, or other key/values)\n\n    command --complex_arg key1,value1:key2,value2\n\n## Repeating Getopt arguments\n\nGetopt friendly, but too verbose\n\n    command --key key1 --value value1 --key key1 --value value 2\n\n# THE DESIGN\n\nThe design of this module is aimed at \"playing well with the shell\". The main purpose is\nto let the user transmit complex data structures, while staying compact enough for command line\nuse.\n\n## Key/Value sets (objects)\n\nOn the command line, the user can transmit sets of key/value pairs within curly brackets\n\n    command { K_V_PAIR1 K_V_PAIR2 }\n\nThe shell is expected to do some work for us, so key/value pairs are separated by spaces\n\nEach key/value pair is expressed as\n\n    Key: Value\n\nThe colon between Keys and values is optional, so\n\n    Key Value\n\nis the same as above\n\nIf the value contains spaces, the user can surround the pair with the shell metacharacters\n\n    command { Key: \" Value \" }\n\nValues can also be objects:\n\n    command { Key: { Nested Key } }\n\nor lists\n\n    command { Key: [ 1 2 3 ] }\n\nIf you want a key with a colon at the end, just repeat the colon:\n\n    Key:: Value\n\n## Lists\n\n    command [ VALUE1 VALUE2 ]\n\nEach value can be a simple scalar value, or an object or list\n\n    command [ { Name X } { Name Y } ]\n    command [ [ 1 2 3 ] [ 4 5 6 ] [ 7 8 9 ] ]\n    command [ \"First Value\" \"Second Value\" ]\n\nValues are never separated by commas to keep the syntax compact. \nThe shell is expected to split the different elements into tokens, so\nthe user is expected to use shell quotes to keep values together\n\n# METHODS\n\n## new(\\[argv =\u003e ArrayRef\\])\n\nReturn an instance of the parser. If argv is not specified, @ARGV will be\nused.\n\n## parse\n\nreturn the parsed data structure\n\n# STATUS\n\nThis module is quite experimental. I developed it while developing Paws (a \nPerl AWS SDK). It has a commandline utility that needs to recollect all the\nAttributes and Values for method calls, and lots of times, they get complex. \nSince trying to pass params with Getopt was getting ugly as hell, I decided \nthat it would be better to do things in a different way, and eventually\nthought it could be an independent module.\n\nI'm publishing this module to get the idea out to the public so it can be worked\non.\n\nPlease bash the guts out of it. Break it and shake it till it falls apart. \n\nContribute bugs and patches. All input is welcome.\n\nTo help with the bashing, when you install this dist, you get a command line util\ncalled argvstruct. It will basically print a Data::Dumper of the structure generated\nby it's arguments\n\n    user@host:~$ argvstruct { Hello Guys How [ Are You { Doing Today } ] }\n    $VAR1 = {\n            'Hello' =\u003e 'Guys',\n            'How' =\u003e [\n                       'Are',\n                       'You',\n                       {\n                         'Doing' =\u003e 'Today'\n                       }\n                     ]\n          };\n\n# \n\n# TODO\n\nTry to combine with Getopt/MooseX::Getopt, so some parameters could be an ARGV::Struct. The\nrest would be parsed Getopt style.\n\n# CONTRIBUTE\n\nThe source code and issues are on https://github.com/pplu/ARGV-Struct\n\n# THANKS\n\nMatt S. Trout for suggesting that ARGV::Struct syntax be JSONY compatible\n\n# AUTHOR\n\n    Jose Luis Martinez\n    CPAN ID: JLMARTIN\n    CAPSiDE\n    jlmartinez@capside.com\n    http://www.pplusdomain.net\n\n# COPYRIGHT\n\nCopyright (c) 2015 by Jose Luis Martinez Torres\n\nThis program is free software; you can redistribute\nit and/or modify it under the same terms as Perl itself.\n\nThe full text of the license can be found in the\nLICENSE file included with this module.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpplu%2Fargv-struct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpplu%2Fargv-struct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpplu%2Fargv-struct/lists"}