{"id":27935453,"url":"https://github.com/jbangdev/jbang-jash","last_synced_at":"2025-05-07T06:16:43.044Z","repository":{"id":288586656,"uuid":"968533418","full_name":"jbangdev/jbang-jash","owner":"jbangdev","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-30T16:58:50.000Z","size":1556,"stargazers_count":58,"open_issues_count":13,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-07T06:16:38.440Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/jbangdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null}},"created_at":"2025-04-18T08:52:41.000Z","updated_at":"2025-05-03T20:11:01.000Z","dependencies_parsed_at":"2025-05-04T11:38:06.081Z","dependency_job_id":null,"html_url":"https://github.com/jbangdev/jbang-jash","commit_stats":null,"previous_names":["maxandersen/jbang-jash","jbangdev/jbang-jash"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbangdev%2Fjbang-jash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbangdev%2Fjbang-jash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbangdev%2Fjbang-jash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbangdev%2Fjbang-jash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbangdev","download_url":"https://codeload.github.com/jbangdev/jbang-jash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252824140,"owners_count":21809715,"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-05-07T06:16:42.416Z","updated_at":"2025-05-07T06:16:43.036Z","avatar_url":"https://github.com/jbangdev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jash\n\n![Maven Central Version](https://img.shields.io/maven-central/v/dev.jbang/jash)\n\n\n## Table of content\n\n* [What is it?](#what-is-it)\n* [How to use it](#how-to-use-it)\n* [How to build](#how-to-build)\n* [Origin story](#origin-story)\n\n## What is it?\n\n![Jash Logo](images/jash_logo.png)\n\n```java\nimport static dev.jbang.jash.Jash.*;\n\n$(\"java -version\").stream().forEach(System.out::println);\n```\n\nA Java library to provide a Process interface that is fluent, predictable and with a great developer experience.\n\n*fluent* - because it provides a fluent API to start and manage processes\n\n*predictable* - because it provides a predictable API to start and manage processes, incl. throwing an exception when the process exits with a non-zero/not-allowed exit code.\n\n*great developer experience* - because it provides a great developer experience to work with processes, incl. streaming collecting it as a string or a list of strings.\n\n## How to use it\n\nAdd the ![Maven Central Version](https://img.shields.io/maven-central/v/dev.jbang/jash) dependency to your project:\n\n\u003cdetails\u003e\n\u003csummary\u003eJBang\u003c/summary\u003e\n\n```java\n//DEPS dev.jbang:jash:RELEASE\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eMaven\u003c/summary\u003e\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003edev.jbang\u003c/groupId\u003e\n    \u003cartifactId\u003ejash\u003c/artifactId\u003e\n    \u003cversion\u003eRELEASE\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eGradle\u003c/summary\u003e\n\n```groovy\ndependencies {\n    implementation 'dev.jbang:jash:RELEASE'\n}\n```\n\u003c/details\u003e\n\n\nThen use one of `Jash.start(String command, String...args)` or `Jash.builder(String command, String args...args)` for a more fine grained configuration:\n\n* Will stream `Stream.of(\"hello\", \"world\")`:\n\n```java\nJash.start(\n\t\"sh\",\n\t\"-c\",\n\t\"echo hello; echo world\")\n\t\t.stream()\n```\n\n* Same as above but using a shell-style call:\n\n```java\nimport static io.ongres.jash.Jash.*;\n\n$(\"echo hello; echo world\").stream()\n```\n\n* As above but pipelining with `cat -n` to add line numbers:\n\n```java\nimport static io.ongres.jash.Jash.*;\n$(\"echo hello; echo world\").pipe(\"cat\", \"-n\").stream()\n```\n\n* Same result as above but passing to `cat` a pure Java Stream:\n\n```java\nJash.start(\"cat\")\n\t\t.inputStream(\n\t\tStream.of(\"hello\", \"world\"))\n\t\t.stream()\n```\n\n* This will print \"hello\" followed by \"world\" but will fail when terminating the Java Stream because the process will exit with a non-zero exit code:\n\n```java\nJash.start(\n\t\"sh\",\n\t\"-c\",\n\t\"echo hello; echo world; exit 79\")\n\t\t.stream()\n\t\t.peek(System.out::println)\n\t\t.count() // \u003c- exception will be thrown here\n```\n\n* Same output as the above but will fail when leaving the `try` block because the process exited with a non-zero exit code:\n\n```java\ntry (Stream\u003cString\u003e stream = Jash.start(\n\t\"sh\",\n\t\"-c\",\n\t\"echo hello; echo world; exit 79\")\n\t\t.withoutCloseAfterLast()\n\t\t.stream()) {\n\tstream\n\t\t.peek(System.out::println)\n\t\t.count();\n} // \u003c- exception will be thrown here when Stream.close() will be called\n```\n\n* Same result as above but will not fail at all as the process exit code is allowed:\n\n```java\nJash.$(\"echo hello; echo world; exit 79\")\n\t\t.withAllowedExitCode(79)\n\t\t.stream()\n\t\t.peek(System.out::println)\n\t\t.count();\n```\n\n* Same result as above but will not fail as any exit code is allowed:\n\n```java\nJash.$(\"echo hello; echo world; exit 79\")\n\t\t.withAllowedExitCode(79)\n\t\t.withAnyExitCode()\n\t\t.stream()\n\t\t.peek(System.out::println)\n\t\t.count();\n```\n\n* You can also specify a timeout that will result in a `ProcessTimeoutException` exception:\n\n```java\nJash.shell(\n\t\"sleep 3600\")\n\t\t.withTimeout(Duration.of(1, ChronoUnit.SECONDS))\n\t\t.stream()\n\t\t.count(); // \u003c- will throw an ProcessTimeoutException exception\n```\n\n## How to build\n\nJava 8+ and Maven are required to build this project.\n\nRun following command:\n\n```bash\ngradle build\n```\n\n### Integration tests\n\nThe integration test suite requires a Unix compatible system is installed on the system and and\nsome very common commands (sh, cat, env and sed).\nTo launch the integrations tests run the following command:\n\n```bash\ngradle test\n```\n\n## Origin story\n\nThis project was originally created as \"fluent-process\" by OnGres, Inc. in 2020. In 2025, it was renamed to \"jash\" (pronounced Jazz, a reference to Java and Shell) to reflect its focus on providing a more idiomatic Java 17+ interface for working with shell processes and streams.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbangdev%2Fjbang-jash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbangdev%2Fjbang-jash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbangdev%2Fjbang-jash/lists"}