{"id":13562432,"url":"https://github.com/alessio/shellescape","last_synced_at":"2025-05-14T16:11:52.545Z","repository":{"id":3903973,"uuid":"51274370","full_name":"alessio/shellescape","owner":"alessio","description":"Escape arbitrary strings for use as command line arguments","archived":false,"fork":false,"pushed_at":"2025-04-11T06:41:00.000Z","size":102,"stargazers_count":180,"open_issues_count":0,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-13T01:55:25.587Z","etag":null,"topics":["command-line","golang","shell","shell-escape","shell-script","shell-scripting","shellescape","string-escape"],"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/alessio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-08T01:18:20.000Z","updated_at":"2025-04-11T03:47:18.000Z","dependencies_parsed_at":"2024-01-14T03:46:04.188Z","dependency_job_id":"96797409-e0dd-4ecd-853b-a33eb73ec1e1","html_url":"https://github.com/alessio/shellescape","commit_stats":{"total_commits":76,"total_committers":10,"mean_commits":7.6,"dds":0.6447368421052632,"last_synced_commit":"a5719a48b388a3407264f09cb823d9be92ea1ad1"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessio%2Fshellescape","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessio%2Fshellescape/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessio%2Fshellescape/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessio%2Fshellescape/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alessio","download_url":"https://codeload.github.com/alessio/shellescape/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248654050,"owners_count":21140235,"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":["command-line","golang","shell","shell-escape","shell-script","shell-scripting","shellescape","string-escape"],"created_at":"2024-08-01T13:01:08.530Z","updated_at":"2025-04-13T01:55:44.946Z","avatar_url":"https://github.com/alessio.png","language":"Go","readme":"# shellescape\n\n![Build](https://github.com/alessio/shellescape/workflows/Build/badge.svg)\n[![GoDoc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square)](https://pkg.go.dev/github.com/alessio/shellescape?tab=overview)\n[![sourcegraph](https://sourcegraph.com/github.com/alessio/shellescape/-/badge.svg)](https://sourcegraph.com/github.com/alessio/shellescape)\n[![codecov](https://codecov.io/gh/alessio/shellescape/branch/master/graph/badge.svg)](https://codecov.io/gh/alessio/shellescape)\n[![Go Report Card](https://goreportcard.com/badge/github.com/alessio/shellescape)](https://goreportcard.com/report/github.com/alessio/shellescape)\n\nEscape arbitrary strings for safe use as command line arguments.\n\n## Contents of the package\n\nThis package provides the `shellescape.Quote()` function that returns a\nshell-escaped copy of a string. This functionality could be helpful\nin those cases where it is known that the output of a Go program will\nbe appended to/used in the context of shell programs' command line arguments.\n\nThis work was inspired by the Python original package\n[shellescape](https://pypi.python.org/pypi/shellescape).\n\n## Usage\n\nThe following snippet shows a typical unsafe idiom:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc main() {\n\tfmt.Printf(\"ls -l %s\\n\", os.Args[1])\n}\n\n```\n\n_[See in Go Playground](https://play.golang.org/p/Wj2WoUfH_d)_\n\nEspecially when creating pipeline of commands which might end up being\nexecuted by a shell interpreter, it is particularly unsafe to not\nescape arguments.\n\n`shellescape.Quote()` comes in handy and to safely escape strings:\n\n```go\npackage main\n\nimport (\n        \"fmt\"\n        \"os\"\n\n        \"al.essio.dev/pkg/shellescape\"\n)\n\nfunc main() {\n        fmt.Printf(\"ls -l %s\\n\", shellescape.Quote(os.Args[1]))\n}\n```\n\n_[See in Go Playground](https://go.dev/play/p/GeguukpSUTk)_\n\n## The escargs utility\n\n__escargs__ reads lines from the standard input and prints shell-escaped versions. Unlike __xargs__, blank lines on the standard input are not discarded.\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessio%2Fshellescape","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falessio%2Fshellescape","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessio%2Fshellescape/lists"}