Sha256: 365522450a2af1108982753d5a76dcdf6907fec587c268ab3cb0ae83d28aa64f

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

complete(:on => Ripl::ShellCommands::PATTERN) do |cmd|
  name   = cmd[1..-1]
  glob   = "#{name}*"
  paths  = Set[]

  # search through $PATH for similar program names
  Ripl::ShellCommands::PATHS.each do |dir|
    Dir.glob(File.join(dir,glob)) do |path|
      if (File.file?(path) && File.executable?(path))
        paths << "!#{File.basename(path)}"
      end
    end
  end

  # add the black-listed keywords last
  Ripl::ShellCommands::BLACKLIST.each do |keyword|
    paths << "!#{keyword}" if keyword.start_with?(name)
  end

  paths
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ripl-shell_commands-0.1.0 lib/ripl/completions/shell_commands.rb