{"id":24228814,"url":"https://github.com/blacha/argo-expr","last_synced_at":"2025-03-04T07:40:57.019Z","repository":{"id":178506802,"uuid":"661950169","full_name":"blacha/argo-expr","owner":"blacha","description":"Argo expression tester","archived":false,"fork":false,"pushed_at":"2023-07-05T12:35:26.000Z","size":71,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-14T11:47:30.498Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/blacha.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-07-04T03:30:12.000Z","updated_at":"2023-07-05T05:11:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"9e5c73d3-d775-4ed0-9b8d-0e72dfb3fe2d","html_url":"https://github.com/blacha/argo-expr","commit_stats":null,"previous_names":["blacha/argo-expr"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fargo-expr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fargo-expr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fargo-expr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacha%2Fargo-expr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blacha","download_url":"https://codeload.github.com/blacha/argo-expr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241809592,"owners_count":20023783,"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":"2025-01-14T11:33:04.997Z","updated_at":"2025-03-04T07:40:57.014Z","avatar_url":"https://github.com/blacha.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Argo workflows expression tester\n\n[Argo](https://github.com/argoproj/argo-workflows) has a complex [expression language](https://argoproj.github.io/argo-workflows/variables/#expression) to modify parameters in its workflows\n\nIt is difficult for a go novices to figure out how these work and what functions can be used.\n\nThis CLI provides a way to test the expressions before submitting the workflow to argo, it dumps failure information\n\n## Installation\n\n```bash\ngo install github.com/blacha/argo-expr@latest\n```\n\n## Usage\n\n### Add 1 to a number\n\n```bash\n$ argo-expr \"{{=asInt(inputs.parameters.name) + 1}}\" --value inputs.parameters.name=\"1\"\n2\n```\n\n### Create a sha256sum\n\n```bash\n$ argo-expr '{{=sprig.sha256sum(\"hello world\")}}'\nb94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\n\n$ argo-expr '{{=sprig.sha256sum(inputs.parameters.value)}}' --value inputs.parameters.value=\"hello world\"\nb94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\n```\n\n### load from file\n\nRead a JSON input file and compute the output\n\n```json\n{\n  \"template\": \"hello world 1+1:{{= 1+1 }} i:{{= inputs.parameters.number }}\",\n  \"values\": {\n    \"inputs.parameters.number\": \"4\"\n  }\n}\n```\n\n```bash\n$ argo-expr --from-file ./input.json\nhello world 1+1:2 i:4\n```\n\nBoth values and the expression from the file can be overridden with `--value` or expression.\n\n```\n$ argo-expr --from-file ./input.json --value inputs.parameters.number=1\nhello world 1+1:2 i:2\n```\n\nOverride input expression\n\n```\n$ argo-expr --from-file ./input.json \"i:{{=asInt(inputs.parameters.number)+3}}\"\ni:7\n```\n\n### Error logs\n\nWhen a template fails to run a somewhat helpful error message is displayed\n\n```\n$ argo-expr \"{{=asInt('hello')}}\"\n\nfailed to evaluate expression: strconv.ParseInt: parsing \"hello\": invalid syntax (1:1)\n | asInt('hello')\n | ^\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblacha%2Fargo-expr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblacha%2Fargo-expr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblacha%2Fargo-expr/lists"}