aboutsummaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/parseopt.h
Commit message (Collapse)AuthorAgeFilesLines
* [dynui] Generalise the concept of a menu to a dynamic user interfaceMichael Brown2024-06-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently have an abstract model of a dynamic menu as a list of items, each of which has a name, a description, and assorted metadata such as a shortcut key. The "menu" and "item" commands construct representations in this abstract model, and the "choose" command then presents the items as a single-choice menu, with the selected item's name used as the output value. This same abstraction may be used to model a dynamic form as a list of editable items, each of which has a corresponding setting name, an optional description label, and assorted metadata such as a shortcut key. By defining a "form" command as an alias for the "menu" command, we could construct and present forms using commands such as: #!ipxe form Login to ${url} item username Username or email address item --secret password Password present or #!ipxe form Configure IPv4 networking for ${netX/ifname} item netX/ip IPv4 address item netX/netmask Subnet mask item netX/gateway Gateway address item netX/dns DNS server address present Reusing the same abstract model for both menus and forms allows us to minimise the increase in code size, since the implementation of the "form" and "item" commands is essentially zero-cost. Rename everything within the abstract data model from "menu" to "dynamic user interface" to reflect this generalisation. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [block] Allow SAN boot device to be identified by UUIDMichael Brown2024-03-061-1/+9
| | | | | | | Add a "--uuid" option which may be used to specify a boot device UUID, to be matched against the GPT partition GUID. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Add parse_uuid() for parsing UUID command-line argumentsMichael Brown2024-02-291-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-021-1/+1
| | | | | | | Relicense files for which I am the sole author (as identified by util/relicense.pl). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Add parse_netdev_configurator()Michael Brown2013-11-051-0/+4
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Add parse_timeout()Michael Brown2013-11-011-0/+1
| | | | | | | | Parsing a timeout value (specified in milliseconds) into an internal timeout value measured in timer ticks is a common operation. Provide a parse_timeout() value to carry out this conversion automatically. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [params] Add support for the general concept of a form parameter listMichael Brown2013-08-191-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Add parse_setting()Michael Brown2013-07-221-1/+15
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Move parse_settings() to parseopt.cMichael Brown2013-07-221-1/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Allow parsed option to be modifiedMichael Brown2013-07-221-9/+9
| | | | | | | Parsing a setting name requires the ability to modify the text being parsed. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [menu] Add menu commandsMichael Brown2012-03-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow iPXE scripts to create menus. For example: #!ipxe menu iSCSI boot demonstration item install Install Fedora to ${root-path} item --default boot Boot from ${root-path} item shell Enter iPXE shell item exit Exit to BIOS choose label && goto ${label} :boot sanboot ${root-path} :install sanhook ${root-path} chain http://${next-server}/fedora.ipxe :shell shell :exit Inspired-by: Robin Smidsrød <robin@smidsrod.no> Tested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Allow "prompt" command to accept character literals for --keyMichael Brown2012-03-291-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Simplify image management commands and internal APIMichael Brown2012-03-241-2/+0
| | | | | | | | | | | | | | | | | | | | | | Remove the name, cmdline, and action parameters from imgdownload() and imgdownload_string(). These functions now simply download and return an image. Add the function imgacquire(), which will interpret a "name or URI string" parameter and return either an existing image or a newly downloaded image. Use imgacquire() to merge similar image-management commands that currently differ only by whether they take the name of an existing image or the URI of a new image to download. For example, "chain" and "imgexec" can now be merged. Extend imgstat and imgfree commands to take an optional list of images. Remove the arbitrary restriction on the length of image names. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Allow for pre-initialised option setsMichael Brown2011-04-241-0/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Add support for boolean optionsMichael Brown2011-03-271-0/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Refer to online documentation for command helpMichael Brown2011-03-041-6/+4
| | | | | | | | | | The online documentation (e.g. http://ipxe.org/cmd/ifopen), though not yet complete, is far more comprehensive than could be provided within the iPXE binary. Save around 200 bytes (compressed) by removing the command descriptions from the interactive help, and instead referring users directly to the web page describing the relevant command. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Add generic option-parsing libraryMichael Brown2010-11-211-0/+127
Command implementations tend to include a substantial amount of common boilerplate code revolving around the parsing of command-line options and arguments. This increases the size cost of each command. Introduce an option-parsing library that abstracts out the common operations involved in command implementations. This enables the size of each individual command to be reduced, and also enhances consistency between commands. Total size of the library is 704 bytes, to be amortised across all command implementations. Signed-off-by: Michael Brown <mcb30@ipxe.org>