{"id":13478854,"url":"https://github.com/simeg/functional-shell","last_synced_at":"2025-05-07T01:24:41.470Z","repository":{"id":45087885,"uuid":"211692188","full_name":"simeg/functional-shell","owner":"simeg","description":"map and filter in your shell","archived":false,"fork":false,"pushed_at":"2022-01-09T20:24:14.000Z","size":44,"stargazers_count":17,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T05:01:38.401Z","etag":null,"topics":["bash","command-line","functional","functional-programming","shell","string-manipulation"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/simeg.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":"2019-09-29T16:30:07.000Z","updated_at":"2024-03-14T02:44:29.000Z","dependencies_parsed_at":"2022-08-23T12:10:08.783Z","dependency_job_id":null,"html_url":"https://github.com/simeg/functional-shell","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/simeg%2Ffunctional-shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simeg%2Ffunctional-shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simeg%2Ffunctional-shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simeg%2Ffunctional-shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simeg","download_url":"https://codeload.github.com/simeg/functional-shell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252794614,"owners_count":21805219,"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":["bash","command-line","functional","functional-programming","shell","string-manipulation"],"created_at":"2024-07-31T16:02:04.541Z","updated_at":"2025-05-07T01:24:41.445Z","avatar_url":"https://github.com/simeg.png","language":"Shell","readme":"# functional-shell ![CI](https://github.com/simeg/functional-shell/workflows/CI/badge.svg)\n\nUse `map` and `filter` in your shell.\n\n*This tool was written for learning and is not optimized for speed or\ncompatibility.*\n\nTested with Zsh and Bash 3/4/5.\n\n# Examples\n\n```bash\n$ find .\n./README.md\n./Makefile\n\n$ find . | map abspath\n/Users/simon/repos/functional-shell/README.md\n/Users/simon/repos/functional-shell/Makefile\n```\n\n```bash\n$ find . | map abspath | map basename\nREADME.md\nMakefile\n```\n\n```bash\n$ find . | map prepend 'file: '\nfile: ./README.md\nfile: ./Makefile\n```\n\n```bash\n$ find . | filter contains md\n./README.md\n```\n\n```bash\n$ find . | filter contains md | map abspath\n/Users/simon/repos/functional-shell/README.md\n```\n\n```bash\n$ seq 3 | map add 100\n101\n102\n103\n```\n\n# Installation\n\nRun the `install.sh` to clone the repo and move the files to `/usr/local/lib`\nand `/usr/local/bin`.\n\n```bash\n$ /bin/bash \u003c(curl -s https://raw.githubusercontent.com/simeg/functional-shell/master/install.sh)\n```\n\n# Operations\n\n### File and Directory operations\n```\nabspath             :: Path   → Path\ndirname             :: Path   → Path\nbasename            :: Path   → Path\nis_dir              :: Path   → Bool\nis_file             :: Path   → Bool\nis_link             :: Path   → Bool\nis_executable       :: Path   → Bool\nexists              :: Path   → Bool\nhas_ext ext         :: Path   → Bool\nstrip_ext           :: Path   → String\nreplace_ext new_ext :: Path   → Path\nsplit_ext           :: Path   → Array\n```\n### Logical operations\n```\nnon_empty           :: *      → Bool\n```\n### Arithmetic operations\n```\nadd num             :: Int    → Int\nsub num             :: Int    → Int\nmul num             :: Int    → Int\neven                :: Int    → Bool\nodd                 :: Int    → Bool\npow num             :: Int    → Int\n```\n### Comparison operations\n```\neq other            :: *      → Bool\nequal other         :: *      → Bool\nequals other        :: *      → Bool\nne other            :: *      → Bool\nnot_eq other        :: *      → Bool\nnot_equals other    :: *      → Bool\nge i                :: Int    → Bool\ngreater_equals i    :: Int    → Bool\ngt i                :: Int    → Bool\ngreater_than i      :: Int    → Bool\nle i                :: Int    → Bool\nless_equals i       :: Int    → Bool\nlt i                :: Int    → Bool\nless_than i         :: Int    → Bool\n```\n### String operations\n```\nreverse             :: String → String\nappend suffix       :: String → String\nstrip               :: String → String\nsubstr start end    :: String → String\ntake count          :: String → String\nto_lower            :: String → String\nto_upper            :: String → String\nreplace old new     :: String → String\nprepend prefix      :: String → String\ncapitalize          :: String → String\ndrop count          :: String → String\nsplit delimiter     :: String → Array\nduplicate           :: String → Array\ncontains substring  :: String → Bool\nstarts_with pattern :: String → Bool\nends_with pattern   :: String → Bool\nlen                 :: String → Int\nlength              :: String → Int\n```\n### Other operations\n```\nid                  :: *      → *\nidentity            :: *      → *\n```\n\n","funding_links":[],"categories":["Shell","bash"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimeg%2Ffunctional-shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimeg%2Ffunctional-shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimeg%2Ffunctional-shell/lists"}