librelist archives

« back to archive

Listbox

Listbox

From:
Per Mikaelsson
Date:
2011-11-14 @ 14:34
Hi all,

I am on a roll here so here is one more question.

if I want my listbox to hold "alias" of commands how do I do that? like I
want to send the command "ls -la" to a linux box but I want the listbox
item to show the user only "ls"

I also wrote this question on irc.

Happy shoeing all

Re: [shoes] Listbox

From:
ashbb
Date:
2011-11-14 @ 15:17
Hi Per,

Try out the following:

require 'green_shoes'
Shoes.app do
  list_box items: ['ls -la', 'hello all'] do |lb|
    p lb.text
  end
end

I got 'ls -la' on my Windows 7. I can't confirm on Linux right now, though.

ashbb

Re: [shoes] Listbox

From:
Per Mikaelsson
Date:
2011-11-14 @ 15:24
Thanks for the help ashbb but I tried irc and got help there, the solution
I am using looks like this.

  @commands = { "ls" => "ls -la", "ifconfig" => "ifconfig", "ps" => "ps
aux" }
  @cmd = list_box :items => @commands.keys

and this to execute the command $output = ssh.exec! @commands[@cmd.text]
Works like a charm :)

Shoe on


2011/11/14 ashbb <ashbbb@gmail.com>

> Hi Per,
>
> Try out the following:
>
> require 'green_shoes'
> Shoes.app do
>   list_box items: ['ls -la', 'hello all'] do |lb|
>     p lb.text
>   end
> end
>
> I got 'ls -la' on my Windows 7. I can't confirm on Linux right now, though.
>
> ashbb
>

Re: [shoes] Listbox

From:
ashbb
Date:
2011-11-14 @ 21:33
Hi Per,

Good solution!
Thank you for sharing. We can learn a lot. ;-)

Keep Shoesing,
ashbb