Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

command line arguments

 [1/12] from: tmail5:cogeco:ca at: 2-Apr-2004 16:11


still a beginner here. i was hardcoding a log file for parseing like this: binkd-log: read/lines %binkd.log and doing a: forall binkd-log [] later on i wanted to add command line parsing so i tried this: either not system/script/args == none [ arg: system/script/args arg: parse arg "" binkd-log: read/lines arg/1 ][ print "usage: <path/to/binkd.log>" ] but i get: ** Script Error: read expected source argument of type: file url object block how do i get the equivalent of 'read/lines %binkd.log' into binkd-log from the arg/1 argument?

 [2/12] from: hallvard:ystad:oops-as:no at: 2-Apr-2004 23:35


Dixit tony summerfelt (23.11 02.04.2004):
>but i get: > >** Script Error: read expected source argument of type: file url >object block
You get an error because
>> type? first arg
== string! So change binkd-log: read/lines arg/1 to binkd-log: read/lines to-file arg/1 HY

 [3/12] from: tmail5:cogeco:ca at: 2-Apr-2004 17:29


On Fri, 02 Apr 2004 23:35:48 +0200, you wrote:
>You get an error because >>> type? first arg
<<quoted lines omitted: 3>>
>to >binkd-log: read/lines to-file arg/1
i had tried that, but there was an error later on that i mistook for an error with the first argument, but turns out it was for a second argument... everything works fine now...much appreciated....

 [4/12] from: antonr:lexicon at: 4-Apr-2004 22:20


You can write: either system/script/args [ instead of:
> either not system/script/args == none [
Anton.

 [5/12] from: tmail5:cogeco:ca at: 4-Apr-2004 18:41


On Sun, 4 Apr 2004 22:20:09 +1000, you wrote:
>You can write: > either system/script/args [ >instead of: >> either not system/script/args == none [
got an error when i tried that:

 [6/12] from: AJMartin::orcon::net::nz at: 5-Apr-2004 16:25


> On Sun, 4 Apr 2004 22:20:09 +1000, you wrote: > > >You can write: > > > either system/script/args [ > > >instead of: > > >> either not system/script/args == none [ > > got an error when i tried that:
Then you almost certainly have an error in the code before this point. :) -- Andrew J Martin ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/

 [7/12] from: antonr:lexicon at: 5-Apr-2004 23:07


What was the error ? Anton.

 [8/12] from: tmail5:cogeco:ca at: 6-Apr-2004 13:33


On Mon, 5 Apr 2004 16:25:19 +1200, you wrote:
>> > either system/script/args [ >> >instead of: >> >> either not system/script/args == none [ >> got an error when i tried that: >Then you almost certainly have an error in the code before this point. :)
here are the first few lines of the program :) ; REBOL [] either not system/script/args == none [ as i mentioned earlier, i'm still a relative newbie with rebol...

 [9/12] from: tmail5:cogeco:ca at: 6-Apr-2004 13:46


On Mon, 5 Apr 2004 23:07:54 +1000, you wrote:
>What was the error ?
this is the section of code in question: Rebol [] either not system/script/args == none [ arg: system/script/args arg: parse arg "" log: to-file arg/1 binkd-log: read/lines log days: to-integer arg/2 ][ print "usage: <path/to/binkd.log> <days>" ask "hit enter:" quit ]

 [10/12] from: maximo:meteorstudios at: 6-Apr-2004 13:53


> -----Original Message----- > From: tony summerfelt [mailto:[tmail5--cogeco--ca]]
<<quoted lines omitted: 12>>
> REBOL [] > either not system/script/args == none [
rebol prefered (and simpler) style: either none? system/script/args [ print "no args" ][ print "args waiting" ] there is a ? for all datatypes and pseudo types. as in block?, string?, series?, number?, etc HTH! -MAx

 [11/12] from: tmail5:cogeco:ca at: 6-Apr-2004 15:20


On Tue, 6 Apr 2004 13:53:53 -0400, you wrote:
>rebol prefered (and simpler) style: >either none? system/script/args [
thanks, i'll use that instead... i got the previous style from an example in the rebol library

 [12/12] from: antonr:lexicon at: 8-Apr-2004 1:27


And what was the error message you received? Anton.

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted