Pregunta

Estoy siguiendo un reparto de la pantalla En una joya de rubí llamada palanca. A las 8:10, se usa el comando .tree, que creo que es un comando unix.

No parece estar trabajando en mi sistema:

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

y he rastreado el problema para aquí, en el que Pry 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

Desde el contexto de Bash intenté usar 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íblemente útil, ¿cómo puedo obtener este comando?

¿Fue útil?

Solución

Usando casería casera:

brew install tree

Usando MacPorts:

sudo port install tree

Usando la fuente:

Sigue estas instrucciones. (Advertencia; debe usar las banderas/etc. que tienen sentido).

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

Otros consejos

Para un enfoque simple, también puede agregar el siguiente alias a su ~/.bashrc o ~/.zshrc expediente:

alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"

Esto da como resultado lo siguiente:

$ tree
.
|____.git
| |____config
| |____objects
| | |____pack
| | |____info
| |____HEAD
| |____info
| | |____exclude
| |____description
| |____hooks
| | |____commit-msg.sample
| | |____pre-rebase.sample
| | |____pre-commit.sample
| | |____applypatch-msg.sample
| | |____pre-receive.sample
| | |____prepare-commit-msg.sample
| | |____post-update.sample
| | |____pre-applypatch.sample
| | |____pre-push.sample
| | |____update.sample
| |____refs
| | |____heads
| | |____tags

Encontré esta solución aquí:

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top