EditForm


EditForm is for editing forms, simple config files, query information from shell scripts, passwords, etc. It works like an off-line HTML form editor and is meant to be used when writing a full-fletched GUI is overkill.

I have written this mainly because I tend to forget the exact names of configure options. Many config files are simple: the KEY=VALUE type of thing. But knowing the exact KEYs is hard for humans while a computer is so picky that I constantly read docs just to look up a simple option name.

With editform, you can write a HTML-like form once and for all and use it to edit the data. Such a form can be provided on the command line so editform can be used to query information from scripts.


Example

User+Password Dialog
> editform -f user+pw -X shell
user='myname'
pw='foo'
user+pw.form:
  <form>
    <dl>
      <dt>Login:</dt>
      <dd><input name="login" /></dd>
      <dt>Password:</dt>
      <dd><input name="pw" type="password" /></dd>
    </dl>
  </form>

A user+pw dialog is predefined and can be invoked by using the -f option. The form is called 'user+pw'. Similarly, there is a predefined password-only form called 'pw'. Invocation in a shell from a shell script is easy. Just select the form and use output format for Bourne shell. E.g. to query a password, use:

    eval `editform -f pw -Xshell`
    if test "$pw" = "secret"; then
        ...
    else
        ...
    fi

Download Source Code


Changes

Content

Index

September 13th, 2008
Comments? Suggestions? Corrections? You can drop me a line.
zpentrabvagiktu@theiling.de
Schwerpunktpraxis