Releases: albertalef/rubyshell
Releases · albertalef/rubyshell
v1.5.0
Added
-
Parallel Execution (#34)
sh do results = parallel do curl("https://api1.example.com") curl("https://api2.example.com") chain { ls | wc("-l") } end results.each { |r| puts r } end
- Returns an Enumerator with results in completion order
- Supports regular commands, chains, and
sh()calls - Errors are captured and returned as values (not raised)
-
Chain Options (#34)
# Debug mode for chains chain(debug: true) { ls | grep("test") } # Parse chain output chain(parse: :json) { curl("https://api.example.com") }
-
Environment Variables (#47)
# Command-level sh.npm("start", _env: { NODE_ENV: "production" }) # Block-level sh(env: { DATABASE_URL: "postgres://localhost/db" }) do rake("db:migrate") end # Global RubyShell.env[:API_KEY] = "secret" RubyShell.config(env: { DEBUG: "true" })
-
Debug Mode (#39)
# Global RubyShell.debug = true # Block scope RubyShell.debug { sh.ls } # Per command sh.git("status", _debug: true) # Output: # Executed: git status # Duration: 0.003521s # Pid: 12345 # Exit code: 0 # Stdout: "On branch main..."
-
Output Parsers (#38)
sh.cat("data.json", _parse: :json) # => Hash sh.cat("config.yml", _parse: :yaml) # => Hash sh.cat("users.csv", _parse: :csv) # => Array
-
Refactored specs directory structure
v1.4.0
What's Changed
- Added a new exe command
$ rubyshell new file, that creates a file already with chmox +x
- Added support for the "stdin" parameter, which allows us to manually pass a string or command to the stdin of another command, for example:
# Before, it could only be like this:
chain { echo("text") | xclip }
# Now it can also be like this:
xclip(_stdin: "text")- Added support for shell commands that have syntax not allowed in Ruby, for example "wl-copy," "notify-send."
# You can do it this way:
sh("notify-send", "hello")- Allowing an array in the hash params of a command
# Before, you could only do it this way:
sed "-e 'one'", "-e 'two'", "-e three"
# Now it can also be like this:
sed e: ["one", "two", "three"]- Corrections in the command executor: previously, if a program was terminated and for some reason its STDOUT had not been closed and was not going to receive any more data, the code would also remain stuck in that STDOUT forever (the same happened for STDERR).
- Added the "quoted" method to strings. The idea here is to wrap a string in quotation marks so that the developer can purposely add it when entering a string in a command, for example:
grim "-g", "4123,898 1280x102" # => grim -g 4123,898 1280x102 => Invalid geometry
grim "-g", "4123,898 1280x102".quoted # => grim -g "4123,898 1280x102"- Added a way to not evaluate a command instantly, giving us the possibility of future evolution, example:
grim!("-g", "position", "-").to_shell # => returns: "grim -g position -"
# You can also do the following after that:
grim!("-g", "position", "-").exec
# Giving us the power to do this as well:
(ls! | wc!).exec # returns a count of files in pwd
# or this:
wc(_stdin: ls!) # returns a count of files in pwd- Changes were also made to the code structure.
@albertalef in #29
Full Changelog: v1.3.5...v1.4.0
v1.3.5
Version 1.3.5
v1.3.4
Version 1.3.4
v1.3.3
Version 1.3.3
v1.3.2
Version 1.3.2
v1.3.1
Version 1.3.1
Release 1.3.0
What's Changed
- Add to readme the shell command execution without a block by @albertalef in #7
- Allow usage without sh block. by @n-at-han-k in #4
- Version 1.3.0 by @albertalef in #9
- Improve errors messages by @albertalef in #13
- Improved IRB output by @n-at-han-k in #11
- feat: add overwrited commands by @albertalef in #19
- Revert "feat: add overwrited commands" by @albertalef in #21
- 18 commands to override by @albertalef in #22
- Add executable file support by @albertalef in #23
New Contributors
- @albertalef made their first contribution in #7
- @n-at-han-k made their first contribution in #4
Full Changelog: https://github.com/albertalef/rubyshell/commits/v1.3.0
