{"id":18279229,"url":"https://github.com/shafreeck/cortana","last_synced_at":"2025-04-05T04:31:36.783Z","repository":{"id":57539407,"uuid":"288786400","full_name":"shafreeck/cortana","owner":"shafreeck","description":"cortana gives you a new style to write command line programs","archived":false,"fork":false,"pushed_at":"2023-04-05T10:43:05.000Z","size":114,"stargazers_count":30,"open_issues_count":3,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T22:23:03.357Z","etag":null,"topics":["command","command-line","command-line-tool","flags","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shafreeck.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-19T16:47:04.000Z","updated_at":"2024-06-29T14:59:56.000Z","dependencies_parsed_at":"2024-06-18T22:57:37.342Z","dependency_job_id":null,"html_url":"https://github.com/shafreeck/cortana","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/shafreeck%2Fcortana","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafreeck%2Fcortana/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafreeck%2Fcortana/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafreeck%2Fcortana/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shafreeck","download_url":"https://codeload.github.com/shafreeck/cortana/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289382,"owners_count":20914463,"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","command-line","command-line-tool","flags","go","golang"],"created_at":"2024-11-05T12:27:57.848Z","updated_at":"2025-04-05T04:31:31.733Z","avatar_url":"https://github.com/shafreeck.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cortana\nAn extremely easy to use command line parsing library \n\n# Features\n\n* Extremely easy to use\n* Handling the sub commands exactly the same as the main command\n* Parse args from configration file, envrionment and flags\n\n## How to use\n\n### Work in the main function\n\n```go\n// say.go\nfunc main() {\n\targs := struct {\n\t\tName string `cortana:\"--name, -n, tom, who do you want say to\"`\n\t\tText string `cortana:\"text\"`\n\t}{}\n\t// Parse the args\n\tcortana.Parse(\u0026args)\n\tfmt.Printf(\"Say to %s: %s\\n\", args.Name, args.Text)\n}\n\n$ go run say.go -n alice hello\nSay to alice: hello\n```\n\n### Use as the sub-command\n\n```go\n// pepole.go\nfunc say() {\n\targs := struct {\n\t\tName string `cortana:\"--name, -n, tom, who do you want say to\"`\n\t\tText string `cortana:\"text\"`\n\t}{}\n\tcortana.Parse(\u0026args)\n\tfmt.Printf(\"Say to %s: %s\\n\", args.Name, args.Text)\n}\n\nfunc main() {\n\t// Add \"say\" as a sub-command\n\tcortana.AddCommand(\"say\", say, \"say something\")\n\tcortana.Launch()\n}\n\n$ go run pepole.go say -n alice hello\nSay to alice: hello\n```\n\n### You defines how the sub-commond looks like without affecting the original implementation\n\n```go\n// people.go\nfunc main() {\n\t// say greeting works by calling the say function\n\tcortana.AddCommand(\"say greeting\", say, \"say something\")\n\t// greeting say also works by calling the say function\n\tcortana.AddCommand(\"greeting say\", say, \"say something\")\n\tcortana.Launch()\n}\n\n$ go run pepole.go say greeting -n alice hello\nSay to alice: hello\n\n$ go run pepole.go greeting say -n alice hello\nSay to alice: hello\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshafreeck%2Fcortana","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshafreeck%2Fcortana","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshafreeck%2Fcortana/lists"}