[Gambas-user] Scripter Add --fromProject to scripter that will convert a project to a script

Bruce Steers bsteers4 at gmail.com
Thu Mar 4 19:14:56 CET 2021


Brilliant thank you Brian, that's going to be much better :)

I gotta ask though how come your example output has line numbers?
I've never seen line numbers before.
I'd agree the output would be helpful if the line numbers of the
constructed file show but i never found they did.

Thanks again
BruceS :)




On Thu, 4 Mar 2021 at 17:48, Brian G <brian at westwoodsvcs.com> wrote:

> Ok, here is what I have done so far,
> The reason for the line of program as well as the error is that it is
> possible the error is from class files and there can be more than one error
>
> -T option is terse
> your script header looks like this:
> #!/usr/bin/env -S gbs3 -T
>
> the output for terse looks like this
> ------------------------------------------------------------------
> # Gambas module file : MMain:11:36
>    11*:Loop   ' should be do...loop until
>                                                            ^ LOOP without
> DO
> -----------------------------------------------------------------------
> Without -T option looks like this:
> --------------------------------------------------------------------------
> # Gambas Project File 3.0
> Title=Gambas Script
> Startup=MMain
> Vendor=Ordinary
> Version=0.0.1
> License=General Public License 2.0
>
> # Gambas module file : MMain:11:36
>     1 :' Gambas module file
>     2 :
>     3 :
>     4 :
>     5 :
>     6 :' #!/usr/bin/env -S gbs3 -c
>     7 :'Auto Generated Script 03/01/2021 23:31:35.409
>     8 :' Gambas module file
>     9 :Public Sub Main()
>    10 :Dim i As Integer = 0
>    11*:Loop   ' should be do...loop until
>                                           ^ LOOP without DO
>    12 :  Inc i
>    13 :  Print "Hello world"
>    14 :
>    15 :Until i > 20
>    16 :End
>    17 :
>
> ------------------------------------------------------------------------------------
> In include the latest dev version of scripter, you will need to make
> install package and uninstall scripter and then install this version
> It has been well test on my 60-70 scripts I use in my work flow. Should be
> stable enough for most uses.
> to go back just uninstall this version and reinstall from daily.
> It has the -T option included.
>
>
> "Failure is the key to success;
>  each mistake teaches us something"  .. Morihei Ueshiba
> Brian G
>
> ----- On Mar 4, 2021, at 8:02 AM, Bruce Steers <bsteers4 at gmail.com> wrote:
>
> Sounds awesome, and like exactly what i said lol  :)
>
> could we Env the option too?
> maybe if the scripter could do something like a simple ..
>
> bStopScriptPrinting = (Env["GB_SCRIPT_ERRORS_ONLY"] = "true")
>
> then we could set a system Env variable so i wouldn't have to add the arg
> each time.
>
> Cheers Bri , that's the only thing i wasn't keen on with the scripter,
> scrolling back through the terminal trying to find the error msg line.
>
> Wishing well
> BruceS
>
> On Thu, 4 Mar 2021 at 15:21, Brian G <brian at westwoodsvcs.com> wrote:
>
>> How about if it just prints the one line in error, so you can identify it
>> in your original script file.
>>
>> --
>> Thanks
>> Brian
>> Wednesday, 03 March 2021, 10:05PM -08:00 from Bruce Steers
>> bsteers4 at gmail.com:
>>
>>
>>
>> On Thu, 4 Mar 2021 at 05:07, Brian G <brian at westwoodsvcs.com> wrote:
>>
>> Right now it will only print warnings if select -w and verbose with -v,
>> it prints the error and listing showing error., The errors are printed
>> first and may come from more that one file being compiled.
>> We could add an option to suppress the error listing of the error file
>> -terse, or maybe the opposite --error-detailed
>> The line numbers mean very little that are displayed in the error reports
>> by the scripter without the listing of the file they are in. As again the
>> there may be errors in more than one compiled file, or included file.
>> Remember that classes are each a separate file to the compiler. As well
>> as the include files.
>>
>> Any ideas what would work best?
>>
>> I'm not sure you understood me , i get the warnings/errors fine i just
>> don't want the entire script printed on an error. the name will do
>>
>> I do not understand why it has to print the entire script on an error.
>> It doesn't just print a "listing" It prints the module name and error
>> position on the 1st line then prints the entire script out!
>> if the script is long enough it goes beyond my terminal scroll limit.
>> Seems erroneous (for my single script usage)
>>
>> On error i get something like the following message...
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *MMain.module:6:12: error: Syntax error# Gambas Project File
>> 3.0Title=Gambas ScriptStartup=MMain' Gambas module file' Gambas script
>> filePublic Sub Main()Dim sBasesShell "dpkg-query --list linux*|grep
>> \"generic\"|grep ii|awk '{print $2}" To sBases*
>>
>> *the rest of the script.....*
>>
>> The 1st line
>> MMain.module:6:12: error: Syntax error
>>
>> tells me all I need to know, i'd like to not see the rest
>> If is makes an alternative project file so the line numbers are different
>> to my actual script then can it not print just the line in error.
>>
>> Was just a thought.
>> All the best
>> BruceS
>>
>> --
>>
>> Thanks
>> Brian
>> Wednesday, 03 March 2021, 03:58PM -08:00 from Bruce Steers
>> bsteers4 at gmail.com:
>>
>> Sounds like a good feature \uD83D\uDE42
>>
>> Is there an option (even a default setting maybe) to not print the script
>> on failure just the error?
>> Or could there be?
>>
>> On Wed, 3 Mar 2021, 23:47 Brian G, <brian at westwoodsvcs.com> wrote:
>>
>> Is anyone interested in having a command line parameter that will allow
>> to create a script from a project?
>>
>> gbs3 --FromProject ~/MyProjectIn ~/MyScriptOut
>>
>> --FromProject having the project directory as input and script path as
>> output
>>
>> "Failure is the key to success;
>>  each mistake teaches us something"  .. Morihei Ueshiba
>> Brian G
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>>
>>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210304/1bebb28b/attachment-0001.htm>


More information about the User mailing list