Object based administrative shell

Dare I say monad ?
Anyway I think an object based shell is a great idea. Has anybody
implemented one in ruby yet ?
I played around and came up with a proof of concept, see the attached file.
run rush and type "ls | b"

Obviously what I have thus far is't very usable. It would be better to
use an irb based approach where command completion etc. could be
implemented.

Is anybody interested in starting such a project ? Is there already one ?

rush.tar.gz (1.48 KB)

···

--
Reyn Vlietstra

Has anybody implemented one in ruby yet ?

Well a search of RubyForge turned up:

http://rubyforge.org/projects/rash/

I played around and came up with a proof of concept, see the attached file.
run rush and type "ls | b"

Interesting concept. Neat to play with.

James Edward Gray II

···

On Aug 17, 2005, at 2:55 PM, Reyn Vlietstra wrote:

There's been some discussion on this with regards to R:O:S. You might
want to dig that up on Rubyforge.

Care to post a few cut-n-paste examples for those of us who don't want to download it or don't have time to. There doesn't seem to be a home page for this project.

Jeff.

···

On 18/08/2005, at 7:51 AM, James Edward Gray II wrote:

On Aug 17, 2005, at 2:55 PM, Reyn Vlietstra wrote:

Has anybody implemented one in ruby yet ?

Well a search of RubyForge turned up:

http://rubyforge.org/projects/rash/

I played around and came up with a proof of concept, see the attached file.
run rush and type "ls | b"

Interesting concept. Neat to play with.

James Edward Gray II

Trans, thanks I had a look at their mailing list and they had a few
nice examples of how something like this can be used, some of which
are included here:

* methods added to filetypes
  * >> somesong.mp3.play
  * >> some.jpg.rotate(90).view
  * >> somefile.extension.defaultopen("/usr/bin/somebinary")
  * >> somefile.extension [which would open it using somebinary]

* custom global objects
  * >> db.somedatabase.sometable.find_all [active_record could be used here]
  * >> apache.config.port = 81 [Not sure how this would work ?
read/write the .conf file ?]
  * >> apache.restart
  * >> samba.config.global.security = user

Unfortunately *nix config files dont follow some sort of standard like
xml, which could have make this alot easier.

Then obviously chaining of commands
  * [grep something] | invoke a graphing application which will show
the number of ocurrances by filename with a bar chart
  * gimp.applyfilter(gimp.filters.blur) | email.send("blured
image","someone@somewhere.com")

There was a suggestion of using opengl for the command line, which
could add some nice functionality:
  * The cli then becomes more of an ide, a combo box could be popped
up for command suggestions instead of the usual list of commands which
saves space.
  * images could be displayed on the cli iteself
  * a nice graph of the chained commands could be displayed with each
command's projected inputs and outputs for the current fsm [Could be
generated by doxygen]

I think this would be a nice project to help unify available
applications/libs on *nix.

jm, the very simple commands included in my previous post are:

class Ls < Command

    respond_to "ls"

    def begin_command(args)
        args = "*" if args == ""
        $objects = Dir.glob(args)
    end

end

class Bracket < Command

    respond_to "b"

    def begin_command(args)
        $objects.map!{|o| "("+o.to_s+")"}
    end

end

They can then be used by doing

ls *.rb | b | b

which would print out all the .rb files each having two brackets around them.

The basic idea currently uses a global $objects to keep track of the
current objects, which I'm not yet convinced is the best solution.

Anybody interested in something like this ?

http://reyn.co.za/rush.tar.gz

···

On 8/18/05, Trans <transfire@gmail.com> wrote:

There's been some discussion on this with regards to R:O:S. You might
want to dig that up on Rubyforge.

--
Reyn Vlietstra

I started a wiki for anyone interested.
http://rush.reyn.co.za/wiki/

···

On 8/18/05, Reyn Vlietstra <reyn.vlietstra@gmail.com> wrote:

Trans, thanks I had a look at their mailing list and they had a few
nice examples of how something like this can be used, some of which
are included here:

* methods added to filetypes
  * >> somesong.mp3.play
  * >> some.jpg.rotate(90).view
  * >> somefile.extension.defaultopen("/usr/bin/somebinary")
  * >> somefile.extension [which would open it using somebinary]

* custom global objects
  * >> db.somedatabase.sometable.find_all [active_record could be used here]
  * >> apache.config.port = 81 [Not sure how this would work ?
read/write the .conf file ?]
  * >> apache.restart
  * >> samba.config.global.security = user

Unfortunately *nix config files dont follow some sort of standard like
xml, which could have make this alot easier.

Then obviously chaining of commands
  * [grep something] | invoke a graphing application which will show
the number of ocurrances by filename with a bar chart
  * gimp.applyfilter(gimp.filters.blur) | email.send("blured
image","someone@somewhere.com")

There was a suggestion of using opengl for the command line, which
could add some nice functionality:
  * The cli then becomes more of an ide, a combo box could be popped
up for command suggestions instead of the usual list of commands which
saves space.
  * images could be displayed on the cli iteself
  * a nice graph of the chained commands could be displayed with each
command's projected inputs and outputs for the current fsm [Could be
generated by doxygen]

I think this would be a nice project to help unify available
applications/libs on *nix.

jm, the very simple commands included in my previous post are:

class Ls < Command

    respond_to "ls"

    def begin_command(args)
        args = "*" if args == ""
        $objects = Dir.glob(args)
    end

end

class Bracket < Command

    respond_to "b"

    def begin_command(args)
        $objects.map!{|o| "("+o.to_s+")"}
    end

end

They can then be used by doing
>> ls *.rb | b | b
which would print out all the .rb files each having two brackets around them.

The basic idea currently uses a global $objects to keep track of the
current objects, which I'm not yet convinced is the best solution.

Anybody interested in something like this ?

http://reyn.co.za/rush.tar.gz

On 8/18/05, Trans <transfire@gmail.com> wrote:
> There's been some discussion on this with regards to R:O:S. You might
> want to dig that up on Rubyforge.
>
>
>

--
Reyn Vlietstra

--
Reyn Vlietstra

jm, the very simple commands included in my previous post are:

Thanks for the examples. I'll also have to take a look at the wiki you've put up as well.

It's interesting to see this concept being developed by someone. I was just think the other day what sort of language would be able to cover the full spectrum from command,shell, to application,OS developement. As shown in the follow diagram be fore warned that there's a bit of hand waving and hair split as the left side of the diagram is exploded compared to the right.

<-------------------------------------------------- ..... ----------->
    > > > > >
command shell shell script application script OS kernel

command is things like "run this now", eg, edit file.txt
shell is where you can start chaining of commands, eg, grep file.txt "^A" | cut -c 10-15 ...
shell script include start up scripts etc.
application scripts are things which are more involved like dynamic web sites, data manipulation, etc.
full applications (not shown) would be things like konqueror or openoffice.
and the far right we all now what an OS kernel is.

The point is that a language that fills more of these niches is more likely to survive long term than one that one that only fills a specific niche. From the lower end, there are contenders like c/c++ but these don't move very well towards the command end of the spectrum. In the middle there is java which is trying to push towards the left of the diagram and rightward with things like javacard, etc. Then there's the "scripting languages" like ruby. Ruby started in the "application script" area and is pushing downwards with the help of the needed speed increase from yarv, but it still lacks the features to let it move any lower in that direction. In the other direction, it is being used by heretix (www.h-e-r-e-t-i-x.org) for start up scripts and OS administration, which I'm sure a few people have already been doing on an ad hoc basis. Projects like yours should then move ruby even futher towards to command/shell side of the spectrum. The "winner" in one respect will be the language which makes this a smooth continuation rather than the bumpy road that it currently is at the moment.

Jeff.

···

On 18/08/2005, at 7:33 PM, Reyn Vlietstra wrote:

Jm, yes I agree, having ruby continuously on a few segments on that
line would make working on unix a dream.

I found a project on rubyforge that fills the command gap.
http://cmdparse.rubyforge.org/
Using this as either a base or part of the shell would make sense. We
just need to be
able to pipe commands together effectively and wrap existing commands.

We really need as much ideas as possible.
Anyone interested dont hesitate to edit the wiki. http://rush.reyn.co.za/wiki

···

On 8/19/05, jm <jeffm@ghostgun.com> wrote:

On 18/08/2005, at 7:33 PM, Reyn Vlietstra wrote:

>
> jm, the very simple commands included in my previous post are:
>
>

Thanks for the examples. I'll also have to take a look at the wiki
you've put up as well.

It's interesting to see this concept being developed by someone. I was
just think the other day what sort of language would be able to cover
the full spectrum from command,shell, to application,OS developement.
As shown in the follow diagram be fore warned that there's a bit of
hand waving and hair split as the left side of the diagram is exploded
compared to the right.

<-------------------------------------------------- ..... ----------->
    > > > > >
command shell shell script application script OS kernel

command is things like "run this now", eg, edit file.txt
shell is where you can start chaining of commands, eg, grep file.txt
"^A" | cut -c 10-15 ...
shell script include start up scripts etc.
application scripts are things which are more involved like dynamic web
sites, data manipulation, etc.
full applications (not shown) would be things like konqueror or
openoffice.
and the far right we all now what an OS kernel is.

The point is that a language that fills more of these niches is more
likely to survive long term than one that one that only fills a
specific niche. From the lower end, there are contenders like c/c++ but
these don't move very well towards the command end of the spectrum. In
the middle there is java which is trying to push towards the left of
the diagram and rightward with things like javacard, etc. Then there's
the "scripting languages" like ruby. Ruby started in the "application
script" area and is pushing downwards with the help of the needed speed
increase from yarv, but it still lacks the features to let it move any
lower in that direction. In the other direction, it is being used by
heretix (www.h-e-r-e-t-i-x.org) for start up scripts and OS
administration, which I'm sure a few people have already been doing on
an ad hoc basis. Projects like yours should then move ruby even futher
towards to command/shell side of the spectrum. The "winner" in one
respect will be the language which makes this a smooth continuation
rather than the bumpy road that it currently is at the moment.

Jeff.

--
Reyn Vlietstra