Module: TerminalNotifier::CLI
- Defined in:
- lib/terminal-notifier/cli.rb
Overview
The bin wrapper's logic, extracted so that it can be tested without spawning a process.
Class Method Summary collapse
-
.argv_for(argv, stdin) ⇒ Object
Folds piped stdin into a -message option, matching the behaviour of the binary itself when data is piped to it directly.
- .run(argv = ARGV, stdin = $stdin) ⇒ Object
Class Method Details
.argv_for(argv, stdin) ⇒ Object
Folds piped stdin into a -message option, matching the behaviour of the binary itself when data is piped to it directly.
11 12 13 14 15 |
# File 'lib/terminal-notifier/cli.rb', line 11 def self.argv_for(argv, stdin) return argv if argv.include?('-message') || stdin.tty? argv + ['-message', stdin.read.chomp] end |
.run(argv = ARGV, stdin = $stdin) ⇒ Object
17 18 19 |
# File 'lib/terminal-notifier/cli.rb', line 17 def self.run(argv = ARGV, stdin = $stdin) exec TerminalNotifier::BIN_PATH, *argv_for(argv, stdin) end |