Absortio

Email → Summary → Bookmark → Email

Release Introducing JBang Jash · jbangdev/jbang-jash

Extracto

JBang Jash (pronounced Jazz, the music style) is a Java library to provide way to run process or shell scripts that is fluent, predictable and with a great developer experience. To use it add a dep...

Resumen

Resumen Principal

JBang Jash (pronunciado Jazz) es una innovadora librería Java diseñada para simplificar y optimizar la ejecución de procesos y scripts de shell, ofreciendo una experiencia de desarrollo fluida, predecible y altamente eficiente. Su propósito central es abstraer las complejidades subyacentes de la interacción con el sistema operativo, como la gestión de hilos, permitiendo a los desarrolladores interactuar con comandos externos de manera sencilla y directa. La librería, disponible a través de la dependencia dev.jbang:jash:0.0.1, presenta una API fluida que soporta tanto la ejecución de comandos directos (Jash.start()) como scripts de shell completos (Jash.shell()), incluyendo una sintaxis concisa mediante importaciones estáticas ($()). Una característica destacada es su robusto manejo de errores por defecto, donde un código de salida diferente de cero de un proceso se interpreta automáticamente como un fallo y lanza una excepción, garantizando una detección proactiva de problemas. J

Contenido

JBang Jash (pronounced Jazz, the music style) is a Java library to provide way to run process or shell scripts that is fluent, predictable and with a great developer experience.

To use it add a dependency to dev.jbang:jash:0.0.1.

A few examples using classic java syntax:

//DEPS dev.jbang:jash:0.0.1

import dev.jbang.jash.Jash;

System.out.println(Jash.start("java", "-version").get());

Jash.shell("echo hello; echo world").stream().forEach(System.out::println);

...or my favourite using static imports:

//DEPS dev.jbang:jash:0.0.1

import static dev.jbang.jash.Jash.*;

$("echo hello; echo world").stream().forEach(System.out::println);

The intent is to make running and getting input from commands and shells super easy by not requiring dealing with all the complexities of multiple threads - Jash will deal with that behind the scenes. Also, Jash, by default, treats exit code !=0 as an error and will thus throw an exception in such a case. There is also ways to do piping and more.

See all this and more examples at https://github.com/jbangdev/jbang-jash.

JBang not required

You can use it completely independently of JBang - it is a standalone Java library useful from any Java-based project, no matter the build tool of choice.

Original idea

The majority of the fluent API design comes from Fluent Process by @teoincontatto. I read his blog and made the initial contribution to the idea of easy shell execution using his FluentProcess API. Unfortunately, after 3+ years no release was ever made with it, thus I decided to go create this fork called JBang Jash as I think the fluent API for Process / Shell execution deserve a chance.

Looking for feedback

This is a 0.0.1 for a reason - I want to evolve the API some more and already started putting some ideas on https://github.com/jbangdev/jbang-jash/issues - if you have ideas/suggestions to better API (or even removal of bad things) do submit an issue.

Changelog

🚀 Features

  • 654694e feat: detect a default shell based on env+OS
  • 1b3923e feat: use predicate for exit codes to allow any, ranges, and just plain list of codes
  • 9299415 feat: ProcessException has command in quotes for better readability
  • de2e39f feat: fluent-process Initial commit

🐛 Fixes

  • 867be22 fix: collect to list to avoid stream close on java 11
  • b22ef09 fix: add multi jdk test + collect to list to avoid stream close on java 11
  • c98ee5a fix: formatting
  • a48b829 fix: update build docs to gradle
  • e2bd6c7 fix: add test based on readme
  • 5acd60a fix: use IT consistently
  • ee8287d fix: left over fluentproces names
  • 1e7a1b8 fix: avoid breaking fluent process API
  • b1e1489 fix: support for interaction with processes
  • ac7106b fix: closing process when terminating to stdin or stdout
  • c873e09 fix: multiline adding multiple args instead of a single one

🧰 Tasks

  • 8664fdb chore: formatting fix
  • 711bbdc chore: avoid test fail due to sh diff on github
  • 5868471 chore: avoid test fail due to sh diff on github
  • 1ca472f chore: avoid test fail due to sh diff on github
  • 07acf6c chore: avoid test fail due to sh diff on github
  • fa354d5 chore: upload gradle test results
  • c532cae chore: formatting fix

🛠 Build

  • 1f2d6ce build: missing wrapper jar
  • dda1fef build: add build/release scripts

📝 Documentation


  • 49b5f3f [patch] relase
  • 984801c consistent header format
  • 516abb8 remove outdated files
  • 01d111f rename fluent-process to jash consistently
  • f11802f format consistently
  • f69d0c3 remove pom.xml and add .justfile for consistency
  • 71797ca move to gradle
  • d81bb38 disable test that generates infinite stream resulting in out of memory on fast machines
  • 9bdeb2a disable checkstyle as impossible to manually fix
  • 1703efd fix header
  • ff8da6d Add support for easy shell based execution.
  • a277824 doc: fixed lastInputStream*/intputStream* description
  • 04265d7 doc: updated README.md
  • 234dd3f doc: updated CHANGELOG
  • f4e8c11 release: 1.0.1

Contributors

We'd like to thank the following people for their contributions:
Matteo Melli, Max Rydahl Andersen|

Full Changelog: https://github.com/jbangdev/jbang-jash/commits/v0.0.1

Fuente: GitHub