[![Contributors][contributors-shield]][contributors-url] [![Forks][forks-shield]][forks-url] [![Stargazers][stars-shield]][stars-url] [![Issues][issues-shield]][issues-url] [![MIT License][license-shield]][license-url] [![LinkedIn][linkedin-shield]][linkedin-url]
Logo

mfform

A simple input form simulating mainframe input forms, think 3270.
View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments
## About The Project [![Product Name Screen Shot][product-screenshot]](https://example.com) mfframe is a small tool I created for gather bits of data from the user. I've recently been playing with [Hercules][Hercules-url], 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.

(back to top)

### Built With * [![Rust][Rustlang.org]][Rust-url] * [![Crossterm][crossterm-logo]][Crossterm-url] * [![nom][nom-logo]][nom-url]

(back to top)

## 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 ```sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` ### Installation ```sh cargo install --git https://github.com/thorhs/mfform ```

(back to top)

## 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.

(back to top)

## Roadmap - [ ] Insert functionality - [ ] Possibly LUA, or other, embedded script for populating SELECTs See the [open issues](https://github.com/thorhs/mfform/issues) for a full list of proposed features (and known issues).

(back to top)

## 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

(back to top)

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

(back to top)

## Contact Your Name - [@thorhs](https://twitter.com/thorhs) - toti@toti.is Project Link: [https://github.com/thorhs/mfform](https://github.com/thorhs/mfform)

(back to top)

## Acknowledgments

(back to top)

[contributors-shield]: https://img.shields.io/github/contributors/thorhs/mfform.svg?style=for-the-badge [contributors-url]: https://github.com/thorhs/mfform/graphs/contributors [forks-shield]: https://img.shields.io/github/forks/thorhs/mfform.svg?style=for-the-badge [forks-url]: https://github.com/thorhs/mfform/network/members [stars-shield]: https://img.shields.io/github/stars/thorhs/mfform.svg?style=for-the-badge [stars-url]: https://github.com/thorhs/mfform/stargazers [issues-shield]: https://img.shields.io/github/issues/thorhs/mfform.svg?style=for-the-badge [issues-url]: https://github.com/thorhs/mfform/issues [license-shield]: https://img.shields.io/github/license/thorhs/mfform.svg?style=for-the-badge [license-url]: https://github.com/thorhs/mfform/blob/master/LICENSE [linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555 [linkedin-url]: https://linkedin.com/in/thorhs [product-screenshot]: images/screenshot.png [Hercules-url]: http://www.hercules-390.org [Rustlang.org]: https://img.shields.io/badge/Rust-000000?style=for-the-badge&logo=rust [Rust-url]: https://rustlang.org [crossterm-logo]: https://github.com/crossterm-rs/crossterm/raw/master/docs/crossterm_full.png [Crossterm-url]: https://github.com/crossterm-rs/crossterm [nom-logo]: https://raw.githubusercontent.com/Geal/nom/main/assets/nom.png [nom-url]: https://github.com/rust-bakery/nom