dan2552 / hedgehog Goto Github PK
View Code? Open in Web Editor NEWRuby/Bash hybrid interactive command line shell
License: MIT License
Ruby/Bash hybrid interactive command line shell
License: MIT License
Crashes out of process.
> cd /
Traceback (most recent call last):
5: from app/app.rb:39:in `<main>'
4: from /Users/dan2552/.gem/ruby/2.5.1/gems/bundler-1.16.3/lib/bundler.rb:543:in `with_env'
3: from app/app.rb:46:in `block in <main>'
2: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/input.rb:6:in `await_user_input'
1: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/input.rb:23:in `get_prompt'
/Users/dan2552/.hedgehog:64:in `block in <top (required)>': undefined method `magenta' for nil:NilClass (NoMethodError)
Traceback (most recent call last):
12: from /Users/dan2552/Dropbox/Hedgehog/bin/../app/app.rb:40:in `<main>'
11: from /Users/dan2552/.rubies/ruby-2.6.0/lib/ruby/2.6.0/bundler.rb:562:in `with_env'
10: from /Users/dan2552/Dropbox/Hedgehog/bin/../app/app.rb:49:in `block in <main>'
9: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/input/loop.rb:5:in `await_user_input'
8: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/input/loop.rb:5:in `loop'
7: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/input/loop.rb:11:in `block in await_user_input'
6: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/execution/runner.rb:14:in `run'
5: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/execution/runner.rb:14:in `each'
4: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/execution/runner.rb:16:in `block in run'
3: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/execution/binary.rb:11:in `run'
2: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/execution/binary.rb:11:in `wait'
1: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/execution/binary.rb:11:in `call'
/Users/dan2552/Dropbox/Hedgehog/app/hedgehog/input/line_editor.rb:49:in `size_changed': undefined method `terminal_did_resize' for nil:NilClass (NoMethodError)
Running bin/hedgehog
causes:
bin/hedgehog: line 7: /usr/local/share/chruby/chruby.sh: No such file or directory
bin/hedgehog: line 8: chruby: command not found
bin/hedgehog
should probably somehow be agnostic to how you install ruby?
I think it would make sense to release chruby support either as a separate gem or at least something that can be optionally required in the .hedgehog
file.
In the meantime, putting the following straight in .hedgehog
should work:
original_cd = function "cd"
function "cd" do |args|
original_cd.call(args)
break unless File.exists?(".ruby-version")
function("chruby").call(Hedgehog::Command::Arguments.new(`cat .ruby-version`.chomp))
end
function "chruby" do |args|
output = `bash -lc "source /usr/local/share/chruby/chruby.sh; chruby #{args}; echo "§chruby-environment§"; ENV"`
out, env_str = output.split("§chruby-environment§\n")
print out
break unless args.count > 0
env_vars = env_str.split("\n").map { |env| env.split("=") }
env_vars.each do |env_var|
variable, value = env_var
next unless ["PATH", "RUBY_ROOT", "GEM_HOME", "GEM_ROOT", "GEM_PATH"].include? variable
ENV[variable] = value
end
end
Hedgehog > $a = "hello\r\ngoodbye"
=> "hello\r\ngoodbye"
Hedgehog > echo $a
goodbye
when typing bin/\t
, should get suggestions on the path
cd -
should return you to the location you came from.
type sleep 10\necho hello
should execute echo hello
after finishing execution of sleep 10
Crashes out of process.
Typed bundle
where ruby was set to system ruby, where no bundler was installed.
Traceback (most recent call last):
9: from app/app.rb:39:in `<main>'
8: from /Users/dan2552/.gem/ruby/2.5.1/gems/bundler-1.16.3/lib/bundler.rb:543:in `with_env'
7: from app/app.rb:46:in `block in <main>'
6: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/input.rb:11:in `await_user_input'
5: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/execution/runner.rb:10:in `run'
4: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/execution/runner.rb:19:in `execute_command'
3: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/execution/runner.rb:19:in `each'
2: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/execution/runner.rb:21:in `block in execute_command'
1: from /Users/dan2552/Dropbox/Hedgehog/app/hedgehog/execution/binary.rb:10:in `run'
/Users/dan2552/Dropbox/Hedgehog/app/hedgehog/execution/binary.rb:10:in `spawn': No such file or directory - /usr/local/bin/bundle (_Errno::ENOENT_)
awk -v term_cols="${width:-$(tput cols || echo 80)}" 'BEGIN{
s="/\\";
for (colnum = 0; colnum<term_cols; colnum++) {
r = 255-(colnum*255/term_cols);
g = (colnum*510/term_cols);
b = (colnum*255/term_cols);
if (g>255) g = 510-g;
printf "\033[48;2;%d;%d;%dm", r,g,b;
printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
printf "%s\033[0m", substr(s,colnum%2+1,1);
}
printf "\n";
}'
It would be amazing to have functionality like the amazing fish-shell's auto suggestions
e.g. correctly handling
echo "hello" | grep b
echo $?
echo "hello" | grep b
$?
The project needs specs
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.