[Gambas-user] a command line with arguments to parsed program?

Dimitris Anogiatis dosida at gmail.com
Wed Oct 16 07:57:05 CEST 2019


You can use gb.args in your program

Arguments are separated by a space when they are used to run the program,

for example when you call a gambas program like this: ./myprogram.gambas -t
-f=2 --no-separate-pages

you have 3 arguments:

-t
-f=2
--no-separate-pages

(these three arguments are just an example they don't mean
anything specific)

Args.Count counts all the arguments, so in our example it would be 4 and
that's because ./myprogram.gambas is also considered an argument (Argument
0, the first argument)

You can check how many arguments we have by using Args.Max, which gives you
whatever Args.Count gives you -1

So when you have more than one argument you can run through them and do
your argument analysis that way.

I think gb.Args also has some helper subs and functions for argument
analysis.

Check the documentation about gb.args and you'll see what I mean.

Hope this helps out.


On Tue, Oct 15, 2019 at 3:22 PM PICCORO McKAY Lenz <mckaygerhard at gmail.com>
wrote:

> El mar., 15 de oct. de 2019 a la(s) 15:28, gen braga
> (genbraga1 at gmail.com) escribió:
> >
> > http://gambaswiki.org/wiki/comp/gb.args
> that wiki page does not have examples
>
> hey i ask about an example that was in logn older examles directory in
> old days when those was distributed alongside with gambas.. ..
>
> i try to find at the gambas farm with tags "example" and "console" and
> i cannot foudn any example
>
> the class wiki page only link here
> https://lists.gambas-basic.org/pipermail/user/2015-November/055653.html
> that has enough code and explanation but the idea was to put directly
> in the wiki so will apears in the ide! X-(
>
> >
> > Active? Nope. Just got a mobile mail reader and commuting time.
> >
> > Em ter, 15 de out de 2019 16:23, PICCORO McKAY Lenz <
> mckaygerhard at gmail.com> escreveu:
> >>
> >> El mar., 15 de oct. de 2019 a la(s) 15:19, gen braga
> >> (genbraga1 at gmail.com) escribió:
> >> >
> >> > Process1=exec[executable, parameters]
> >>
> >> PUFFF stupid english...
> >>
> >> i mean i want to make a gambas console project that receive arguments..
> ..+
> >>
> >> are you so active here right? that's good!+
> >>
> >> >
> >> > -
> >> > Regards.
> >> >
> >> > Em ter, 15 de out de 2019 16:11, PICCORO McKAY Lenz <
> mckaygerhard at gmail.com> escreveu:
> >> >>
> >> >> i cannot see in examples a command line made that can receive
> parameters..
> >> >>
> >> >> i just guess that in older versions of gamgbas (where examples are
> >> >> come buld in) there's one
> >> >>
> >> >>
> >> >> or not? if there's one.. where are that example?
> >> >>
> >> >> Lenz McKAY Gerardo (PICCORO)
> >> >> http://qgqlochekone.blogspot.com
> >> >>
> >> >> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net
> ]----
> >> >
> >> >
> >> > ----[ Gambas mailing-list is hosted by https://www.hostsharing.net
> ]----
> >>
> >> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net
> ]----
> >
> >
> > ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20191015/a83b7281/attachment.html>


More information about the User mailing list