Re: Command line args (was: API Changes)

From: mitchell <mforal.n....at.gmail.com>
Date: Wed, 16 Jun 2010 08:43:54 -0700 (PDT)

Robert,

On Jun 16, 5:47 am, Robert <ro....at.web.de> wrote:
> On Tue, Jun 15, 2010 at 6:29 PM, Robert <ro....at.web.de> wrote:
> > On Mon, Jun 14, 2010 at 3:49 PM, mitchell <mforal.n....at.gmail.com> wrote:
>
> >>> Command line arguments - would you consider adding command line
> >>> switches for setting the location of userhome and
> >>> loading? This would be very useful now that I have two incompatible
> >>> Textadept versions. Possibly,
> >>> -p or --plain for loading Textadept without userhome
> >>> -u <path> or --userhome <path> for setting the userhome location
>
> >> Submit a patch :)
>
> > I got something [1] working, my problem now is that RESETTING seems
> > not to be available in
> > core/init.lua, so after a reset() I get the default .textadept.
> > "args" seem to persist a resetting so I could leave it there to
> > re-read after a reset.
>
> [1]:http://gist.github.com/439330
>
> I updated this. I put the argument parsing code in a separate file in
> core that creates flags that can be processed later. The arg table
> persists resetting so they are processed again after a reset.
> What do you think? Could that be the way to go?
> I tried adding a help text as well. However, if I use quit() I get a
> segmentation fault if I use it too early or the Textadept window is
> created and then closed.

core/init.lua is loaded and then gtk_main() is executed. When quit()
is called, gtk_main_quit() is called. As you probably imagined,
gtk_main_quit() being called before gtk_main() would be a problem!

One issue with arg being processed again is with filenames as
arguments; they'll be reloaded.

Mitchell

>
Received on Wed 16 Jun 2010 - 11:43:54 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:48:13 EST