Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Releases: albertalef/rubyshell

v1.5.0

06 Feb 00:36
@github-actions github-actions

Choose a tag to compare

demo

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

Assets 4
Loading
albertalef and NNBnh reacted with rocket emoji
2 people reacted

v1.4.0

23 Jan 03:03
@github-actions github-actions

Choose a tag to compare

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

Contributors

albertalef
Loading
albertalef reacted with heart emoji
1 person reacted

v1.3.5

20 Jan 16:07
@github-actions github-actions

Choose a tag to compare

Version 1.3.5
Loading
NNBnh and albertalef reacted with heart emoji
2 people reacted

v1.3.4

20 Jan 15:59
@github-actions github-actions

Choose a tag to compare

Version 1.3.4
Loading
NNBnh and albertalef reacted with heart emoji
2 people reacted

v1.3.3

20 Jan 15:53
@github-actions github-actions

Choose a tag to compare

Version 1.3.3
Loading

v1.3.2

20 Jan 15:50
@github-actions github-actions

Choose a tag to compare

Version 1.3.2
Loading

v1.3.1

19 Jan 23:30
@github-actions github-actions

Choose a tag to compare

Version 1.3.1
Loading
NNBnh reacted with hooray emoji
1 person reacted

Release 1.3.0

19 Jan 02:24
@albertalef albertalef
49627d8
This commit was created on GitHub.com and signed with GitHub’s verified signature.
GPG key ID: B5690EEEBB952194
Verified
Learn about vigilant mode.

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: https://github.com/albertalef/rubyshell/commits/v1.3.0

Contributors

n-at-han-k and albertalef
Loading

AltStyle によって変換されたページ (->オリジナル) /