|
pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
|
File defining the pftool entrypoint. More...
#include <filesystem>#include <fstream>#include "pflib/Compile.h"#include "pflib/Parameters.h"#include "pflib/version/Version.h"#include "pftool.h"Functions | |
| pflib::logging::logger | get_by_file (const std::string &filepath) |
| get a logger using the file name as the channel name | |
| ENABLE_LOGGING () | |
| std::string | exec (const char *cmd) |
| Execute a command and capture its output into a string. | |
| bool | is_fw_active (const std::string &name) |
| Check if the firmware supporting the HGCROC is active. | |
| std::string | fw_version () |
| Get the current firmware version. | |
| static void | status (Target *pft) |
| Main status of menu. | |
| int | main (int argc, char *argv[]) |
| This is the main executable for the pftool. | |
Variables | |
| const std::string | FW_SHORTNAME_FIBERLESS = "hcal-zcu102" |
| firmware name as it appears as a directory on disk | |
| const std::string | FW_SHORTNAME_UIO_ZCU = "dualtarget-zcu102" |
File defining the pftool entrypoint.
The commands are written into files corresponding to the menu's name.
| std::string exec | ( | const char * | cmd | ) |
Execute a command and capture its output into a string.
The maximum output is 128 characters.
| [in] | cmd | command C-string to run |
shamelessly taken from https://stackoverflow.com/a/478960
| std::string fw_version | ( | ) |
Get the current firmware version.
This takes a moment because we simply retrieve the version using an rpm query and the exec function.
| pflib::logging::logger get_by_file | ( | const std::string & | filepath | ) |
get a logger using the file name as the channel name
the filename's extension is removed and the file path that is shared with the directory of this file is replaced by 'pftool'.
| bool is_fw_active | ( | const std::string & | name | ) |
Check if the firmware supporting the HGCROC is active.
| int main | ( | int | argc, |
| char * | argv[] ) |
This is the main executable for the pftool.
If '-h' or '–help' is the only parameter provided, the usage information is printed and we exit; otherwise, we continue.
The RC files are read from ${PFTOOLRC}, pftoolrc, and ~/.pftoolrc with priority in that order. Then the command line parameters are parsed; if not hostname(s) is(are) provided on the command line, then the 'default_hostname' RC file option is necessary.
Initialization scripts (provided with -s) are parsed such that white space and lines which start with # are ignored. The keystrokes in those "sripts" are run upon launching of the menu and then the user gets control of the tool back after the script is done.
Parse Command Line Parameters
Load the configuration YAML
Run tool
|
static |
Main status of menu.
Prints the firmware and software versions
| [in] | pft | pointer to active target |