{"id":16301152,"url":"https://github.com/softmoth/raku-text-shellwords","last_synced_at":"2025-06-27T02:33:07.628Z","repository":{"id":147469744,"uuid":"278855617","full_name":"softmoth/raku-Text-ShellWords","owner":"softmoth","description":"Split a string into words like a command-line shell","archived":false,"fork":false,"pushed_at":"2020-07-12T08:43:59.000Z","size":16,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T01:16:39.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"artistic-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softmoth.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","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}},"created_at":"2020-07-11T12:18:03.000Z","updated_at":"2021-05-14T16:00:31.000Z","dependencies_parsed_at":"2023-07-29T22:26:54.952Z","dependency_job_id":null,"html_url":"https://github.com/softmoth/raku-Text-ShellWords","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/softmoth/raku-Text-ShellWords","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softmoth%2Fraku-Text-ShellWords","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softmoth%2Fraku-Text-ShellWords/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softmoth%2Fraku-Text-ShellWords/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softmoth%2Fraku-Text-ShellWords/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softmoth","download_url":"https://codeload.github.com/softmoth/raku-Text-ShellWords/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softmoth%2Fraku-Text-ShellWords/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262177768,"owners_count":23270932,"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-10-10T20:53:59.351Z","updated_at":"2025-06-27T02:33:07.573Z","avatar_url":"https://github.com/softmoth.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"NAME\n====\n\nText::ShellWords - Split a string into words like a command-line shell\n\nSYNOPSIS\n========\n\n```raku\nuse Text::ShellWords;\n\nmy $input = Q{printf \"%s\\n\" 1 \"2 hello\" '3 world' 4\\ .};\nmy @output = run(:out, shell-words $input).out.lines(:close);\n.put for @output;       # OUTPUT: «1␤2 hello␤3 world␤4 .␤»\n```\n\nDESCRIPTION\n===========\n\nText::ShellWords provides routines to split a string into words, respecting the Unix Bourne Shell (`/bin/sh`) quoting rules. From the `bash` manual page:\n\n  * There are three quoting mechanisms: the escape character, single quotes, and double quotes.\n\n    A non-quoted backslash (`\\`) is the escape character. It preserves the literal value of the next character that follows, with the exception of *newline*. If a `\\`*newline* pair appears, and the backslash is not itself quoted, the `\\`*newline* is treated as a line continuation (that is, it is removed from the input stream and effectively ignored).\n\n    Enclosing characters in single quotes preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.\n\n    Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of `\\`. The backslash retains its special meaning only when followed by one of the following characters: `\"`, `\\`, or *newline*. A double quote may be quoted within double quotes by preceding it with a backslash.\n\n  * Unlike the Bourne Shell, the characters `$`, `` ` ``, and `!` have no special meaning to this module.\n\nclass Text::ShellWords::Grammar\n-------------------------------\n\nParsing grammar for a shell-input string\n\nclass Text::ShellWords::WordFailure\n-----------------------------------\n\nError indicator for an incomplete parse\n\n### Incomplete parsing\n\nWhen the input string is malformed, or intended to continue on another line, the last word is made a `WordFailure` object, rather than a `Str`. This object behaves just like any `Failure`, but it stringifies to the final piece of input text if it has been `handled` (by testing if it is `True` or `defined`).\n\n```raku\nmy @words = shell-words 'hello, \"world';\nput @words[0];      # OUTPUT «hello,␤»\ntry put @words[1];  # OUTPUT «»\nput $!.message;     # OUTPUT «Input is malformed or incomplete, ends with '\"world'␤»\n# Now that it's been handled, it can used as a Str\nput @words[1];      # OUTPUT «\"world␤»\n# But it is still a Failure\nsay @words[1].^name if not @words[1];   # OUTPUT: «Text::ShellWords::WordFailure␤»\n```\n\nclass Text::ShellWords::Actions\n-------------------------------\n\nActions class for C\u003c.parse\u003e. Use C\u003c.new(:keep)\u003e to keep quoting characters in the made words\n\nshell-words\n-----------\n\n### sub shell-words\n\n```perl6\nsub shell-words(\n    Cool:D $input,\n    Bool :$keep = Bool::False\n) returns Mu\n```\n\nSplit a string into its shell-quoted words. If C\u003ckeep\u003e is True, the quote characters are preserved in the returned words. By default they are removed.\n\nSEE ALSO\n========\n\nThis module is inspired by, but has different behavior than, Perl's [Text::ParseWords](https://metacpan.org/pod/Text::ParseWords) and [Text::Shellwords](https://metacpan.org/pod/Text::Shellwords).\n\nThe [Bash manual page](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Quoting) describes the three quoting mechanisms copied by this module.\n\nAUTHOR\n======\n\nTim Siegel \u003csiegeltr@gmail.com\u003e\n\nCOPYRIGHT AND LICENSE\n=====================\n\nCopyright 2020 Tim Siegel\n\nThis library is free software; you can redistribute and modify it under the [Artistic License 2.0](http://www.perlfoundation.org/artistic_license_2_0).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftmoth%2Fraku-text-shellwords","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftmoth%2Fraku-text-shellwords","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftmoth%2Fraku-text-shellwords/lists"}