{"id":19313636,"url":"https://github.com/mingrammer/casec","last_synced_at":"2025-04-22T16:31:15.129Z","repository":{"id":57500667,"uuid":"121092974","full_name":"mingrammer/casec","owner":"mingrammer","description":":rainbow: A text case converter","archived":false,"fork":false,"pushed_at":"2019-11-19T14:27:46.000Z","size":38,"stargazers_count":14,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T17:54:06.390Z","etag":null,"topics":["case","case-converter","cli","go"],"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/mingrammer.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}},"created_at":"2018-02-11T06:28:27.000Z","updated_at":"2023-03-30T15:30:28.000Z","dependencies_parsed_at":"2022-08-30T20:10:17.803Z","dependency_job_id":null,"html_url":"https://github.com/mingrammer/casec","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingrammer%2Fcasec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingrammer%2Fcasec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingrammer%2Fcasec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingrammer%2Fcasec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mingrammer","download_url":"https://codeload.github.com/mingrammer/casec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223900316,"owners_count":17222028,"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":["case","case-converter","cli","go"],"created_at":"2024-11-10T00:40:31.683Z","updated_at":"2024-11-10T00:40:32.255Z","avatar_url":"https://github.com/mingrammer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cbr\u003e\u003cbr\u003e\n\n\u003ch1 align=\"center\"\u003eCasec\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://godoc.org/github.com/mingrammer/casec\"\u003e\u003cimg src=\"https://godoc.org/github.com/mingrammer/casec?status.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://goreportcard.com/report/github.com/mingrammer/casec\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/mingrammer/casec\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/mingrammer/casec\"\u003e\u003cimg src=\"https://travis-ci.org/mingrammer/casec.svg?branch=master\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\nA text case converter\n\u003c/p\u003e\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\ncasec is a text case converter for programmers. casec now supports  `upper`, `lower`, `title`, `camel`, `pascal`, `snake`, `kebab` (or `lisp`) cases.\n\nIt also provides case conversion library not only command line tool.\n\n## Installation\n\n### Using go get\n\n\u003e Go version 1.10 or higher is required.\n\n```\ngo get github.com/mingrammer/casec/...\n```\n\nIf you want to only download the `casec` library\n\n```\ngo get github.com/mingrammer/casec\n```\n\n### Using [homebrew](https://brew.sh)\n\n```\nbrew tap mingrammer/casec\nbrew install casec\n```\n\n### Using .tar.gz archive\n\nDownload gzip file from [Github Releases](https://github.com/mingrammer/casec/releases/latest) according to your OS. Then, copy the unzipped executable to under system path.\n\n## Usage\n\n### CLI\n\nConvert all words to snake case.\n\n```bash\n$ casec -t snake main.py\n```\n\nConvert all snake case to camel case.\n\n```bash\n$ casec -f snake -t camel internal.go\n```\n\nConvert only 20~50 lines from snake case to camel case.\n\n```bash\n$ casec -f snake -t camel -l 20:50 internal.go\n```\n\nShow how would have been converted. (dry-run)\n\n```bash\n$ casec -f snake -t kebab -n match.lisp\n```\n\nConvert all camel case to snake case except for words you don't want to convert. It is useful for preventing the keywords (reserved words) or conventions from converting.\n\n```bash\n$ casec -f snake -t pascal -i '^package|var|const|if|for|range|return|func|go$' redis.go\n```\n\nYou can pass multiple ignore expressions.\n\n```bash\n$ casec -f snake -t pascal -i '^package|var|const|if|for|range|return|func|go$' -i '^github|com$' redis.go\n```\n\n### Library\n\n\u003e See details in [GoDoc](https://godoc.org/github.com/mingrammer/casec)\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/mingrammer/casec\"\n)\n\nfunc main() {\n    fmt.Println(casec.IsSnake(\"this_is_snake\"))\n    // Output: true\n    fmt.Println(casec.IsCamel(\"thisIsNot_camelCase\"))\n    // Output: false\n    fmt.Println(casec.Invert(\"Invert Me\"))\n    // Output: iNVERT mE\n    fmt.Println(casec.ToCamel(\"write_rune\"))\n    // Output: writeRune\n    fmt.Println(casec.ToSnake(\"IPAddress\"))\n    // Output: ip_address\n    fmt.Println(casec.ToKebab(\"simpleJSONParser\"))\n    // Output: simple-json-parser\n}\n```\n\n## Known issues\n\ncasec separates the words with non-letters (except `-` and `_`) including `.` and `/` letters. So, the `ignore` option of casec can not recognize the dot-or-slash separated word (ex. `\"github.com/mingrammer/cfmt\"`) as a single chunk. So if you want to prevent the import path of Go source code, for example, `import \"github.com/mingrammer/cfmt\"` from converting, you should pass the ignore expression as `-i \"^(github|com|mingrammer|cfmt)$\"`.\n\nHere is a (maybe) solution for solving this issue.\n\n1. Treat the string surrounded with quotes (\"\" or '') as a single word optionally.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmingrammer%2Fcasec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmingrammer%2Fcasec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmingrammer%2Fcasec/lists"}