Skip to content

Commit

Permalink
Command Not Found ("./", and empty input)
Browse files Browse the repository at this point in the history
  • Loading branch information
noituri committed Nov 4, 2018
1 parent 61e4a9d commit 52bcb4c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/LoveShell.cr
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ module LoveShell
":".colorize.mode(:bold).to_s +
" Command ".colorize(:yellow).to_s +
%(").colorize.mode(:bold).to_s +
input.colorize(:red).mode(:bold).to_s +
args[0].colorize(:red).mode(:bold).to_s +
%(" ).colorize.mode(:bold).to_s +
"not found".colorize(:yellow).to_s +
"!".colorize(:red).to_s
Expand Down
18 changes: 13 additions & 5 deletions src/commands.cr
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,20 @@ class Commands
end

def exists?(command) : Bool
cmd_exists = false
getCommands.each do |cmd|
if command == cmd
cmd_exists = true
end
if !command.empty?
cmd_exists = false
getCommands.each do |cmd|
if command == cmd
cmd_exists = true
end
end
if !{'.', '/'}.includes? command
cmd_exists = true
end
else
cmd_exists = true
end

cmd_exists
end
end

0 comments on commit 52bcb4c

Please sign in to comment.