mfform 0.4.0

A simple input form simulating mainframe input forms, think 3270.
mfform-0.4.0 is not a library.
Visit the last successful build: mfform-0.2.1

Contributors Forks Stargazers Issues MIT License LinkedIn

About The Project

Product Name Screen Shot

mfframe is a small tool I created for gather bits of data from the user. I've recently been playing with Hercules, the mainframe emulator, as well as having a long standing facinations with them. So, I did what anyone would do, I created a small utility that presents the user with a 3270-like dialog asking for input.

Built With

  • Rust
  • Crossterm
  • nom

Getting Started

Start by creating a screen.mfform with the inputs requested (see below), then run the program by calling mfform.

Prerequisites

For now you need the rust compiler:

  • rustup
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    

Installation

cargo install --git https://github.com/thorhs/mfform

Usage

Configuration file

An example configuration file is below:

LABEL 8 2 USER ===>
LABEL 4 4 PASSWORD ===>
LABEL 6 6 NUMBER ===>
LABEL 5 8 DEFAULT ===>

INPUT    18 2 8 username
PASSWORD 18 4 8 password
NUMBER   18 6 8 number
INPUT    18 8 8 default awesome!

SELECT username id1 First!
SELECT username id2 Second
SELECT username id3 Third
SELECT username id4 Fourth

LABEL lines are made up of the LABEL keyword, followed by the x,y coordinates for the label, and the value. Everthing after the y coordinate is used as the text, there is no need to quote the string.

INPUT lines start with the same x,y coordinates followed by the input field length and the field name. An optional default value can follow the field name.

PASSWORD lines work just as the INPUT lines, except the input value is masked on screen. Please note that the value will be in plain text in the program output.

NUMBER lines work like INPUT lines, except the only accept numbers.

SELECT lines have a field name, item ID and item text. This enables F4 for the particular input field and adds the id/text combo as a possible item to select.

Using the utility

Once you have mfform running the following keyboard shortcuts are available:

  • Enter - Submits the input form, causing the program to print the field values in a name=value format and exiting.
  • Esc - Aborts the input form, nothing gets written to stdout and the program exits.
  • F4 - For input fields that have SELECTs, will trigger a 'popup' form allowing the user to select an item for use as value.
  • Tab/Shift+Tab - Next/Previus input field.
  • Arrow keys - Move around on the screen.
  • Backspace - When on an input field will remove the previous character and shift the remainder to the left.
  • Del - When on an input field will remove the current character and shift the remainder to the left.
  • Ctrl-D - Will enable debug output below the form, not really usefull for end users.
  • Ctrl-C - Should always abort the form and exit cleanly to shell.
  • Any other character - Overwrite the current character when in an input field. There is no inser functionality yet. Any unicode 'should' be supported.

Roadmap

  • Insert functionality
  • Possibly LUA, or other, embedded script for populating SELECTs

See the open issues for a full list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Your Name - @thorhs - toti@toti.is

Project Link: https://github.com/thorhs/mfform

Acknowledgments