Hi Manuel,

> I want to use AutoOpts for Shell script generation, and in previous
> letters Bruce already introduced me on how to compile the def-file so a
> shell script is created.

Bruce has forgotten which flavor, since you can either produce shell
script or a binary option processing "partner", a la:

  opts=`${0}-opts ${1+"$@"}`
  eval "$opts"
  case "X${OPTION_CT}" in
  X  ) exit 1 ;;
  X0 )  : ;;
  *  )  shift ${OPTION_CT} ;;
  esac

or source or auto-edit in the generated script:

  . ${0}-opts.sh ${1+"$@"}

> Now i want to to modify the shell script found at
> https://github.com/codeless/MyRex/blob/master/myrex.sh to use AutoOpts.
> Several parameters for this script are forced, but this doesn't seem to
> work with AutoOpts. For instance:
> 
> flag = {
>   name = sqlfile;
>   descrip = "SQL file to be executed";
>   arg-type = file;
>   must-set = true;
> }
> 
> I want AutoOpts to check for the parameter "sqlfile", which has to be
> set and should be checked if it's a valid (existing) file. How to
> achieve this? Is it possible with AutoOpts for Shell-Scripts?

That is done with a companion binary, but I don't know if I did that
for the emitted shell script.  It would be reasonable to check the
minimum count/must-set status and emit appropriate code.  I am
certain I haven't done it for "must-set", I might have for "min = 1".
"must-set" is only 6 or 7 years old.

> Further on, i want to force the user to pass a directory-path to the
> script (not as flag); i used:
> 
> argument = file;
> 
> Is this the way to go?

That is the way to go.  Is it actually implemented?  That is a completely
different question.  Since "file" arguments are something from the last
few years and I haven't done much with shell script stuff for close to a
decade, (Parts of makeshell.c file havn't been touched in 14 years. :)
I'm pretty sure that no verifications get inserted into the script.

If you are willing and able to have a binary option parser program,
you'd get more consistency and easier support.  Otherwise, for fastest
support, you'd be most welcome to fiddle the code in autoopts/makeshell.c
and the various strings it uses in autoopts/ao-strs.def.

> Thanks for any help!!

I'd be thanking -you-!  :)  Cheers - Bruc

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Autogen-users mailing list
Autogen-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/autogen-users

Reply via email to