2011-11-29 6 views
22

Estoy siguiendo un screen cast en una gema de rubí llamada pry. A las 8:10, se usa el comando .tree, que creo que es un comando de Unix.comando de árbol en osx bash

No parece estar funcionando en mi sistema:

[24] pry(main)> .tree 
\Error: there was a problem executing system command: tree 

y he rastreado la cuestión de here, en el que hacer palanca hace referencia a un comando shell:

Pry::CommandSet.new do 

    command(/\.(.*)/, "All text following a '.' is forwarded to the shell.", :listing => ".<shell command>") do |cmd| 
    if cmd =~ /^cd\s+(.+)/i 
     dest = $1 
     begin 
     Dir.chdir File.expand_path(dest) 
     rescue Errno::ENOENT 
     output.puts "No such directory: #{dest}" 
     end 

    else 
     if !system(cmd) 
     output.puts "Error: there was a problem executing system command: #{cmd}" 
     end 
    end 
    end 

del contexto de bash He intentado utilizar el árbol de comandos sin suerte:

projects/sms(apps2)$ tree 
-bash: tree: command not found 
~/projects/sms(apps2)$ .tree 
-bash: .tree: command not found 

Esto se ve increíble muy útil, ¿cómo puedo obtener este comando?

Respuesta

47

Usando homebrew:

brew install tree

Usando macports:

sudo port install tree

Usando the source:

Follow these directions. (Advertencia; deberías usar las banderas/etc. eso tiene sentido.)

< rant> Todos los sistemas deben venir con tree; Lo uso mucho. Y podemos publicar estructuras de directorios como texto, no como fotos. </rant>

Cuestiones relacionadas