You can control ReqView native applications from command line to automate some repetitive tasks without user interaction.
Note: You should run the ReqView commands with the ReqView application window closed. If the ReqView native application is already running then the command just focuses the ReqView window without executing the command.
Please follow instructions in section Install ReqView to install ReqView native application to your system. The specific location of the executable binary depends on your operating system.
The ReqView Windows application installer stores two ReqView binaries in your user profile folder %LocalAppData%\reqview:
Because the installer does not update your PATH
environment variable it could be convenient to create a variable for executing ReqView to run the executable binary directly, e.g. in cmd
:
> set "reqview=%LocalAppData%\reqview\app-2.17.2\ReqView.exe"
Then you can simply run ReqView CLI as follows:
> %reqview% --version
If the exit code is needed during an interactive cmd
session, use the start /w
internal command:
> start /w %reqview% --version
Afterwards, the exit code is available in the %ERRORLEVEL%
variable:
> echo %ERRORLEVEL%
If you prefer using Powershell, the following line will start ReqView, wait until it terminates and retrieve the exit code:
> (start $env:LocalAppData\reqview\app-2.17.2\ReqView.exe -ArgumentList "--version" -NoNewWindow -PassThru -Wait).ExitCode
The ReqView Mac application installer stores the executable binary in folder /Applications/ReqView.app/Contents/MacOS/reqview. You can optionally create a link from /usr/local/bin system folder to run ReqView CLI directly:
$ ln -s "/Applications/ReqView.app/Contents/MacOS/reqview" /usr/local/bin/
The ReqView Linux application installer stores the executable binary in system folder /usr/bin so you can run ReqView CLI directly.
You may find it useful to run ReqView as part of your continuous integration (CI) system, such as Travis, Jenkins or GitLab CI. For instance, you can run export
command to generate the latest version of HTML requirements documentation after each commit of a changed ReqView project to your version control system.
Because ReqView CLI needs a display driver to launch you should configure a virtual display driver to run ReqView on a CI system.
For Linux CI systems based on Debian run the following command to install the required virtual display driver packages:
$ sudo apt install libgdk-pixbuf2.0-0 libgtk-3-0 libxss1 libgbm1 xvfb
Then you can use ReqView CLI in your CI scripts as follows:
$ xvfb-run -a -s "-screen 0 1024x768x24" reqview --version
Display information about available commands and their parameters.
Usage:
$ reqview --help
Commands:
reqview export Export documents to DOCX, XLSX, HTML, PDF or CSV formats.reqview open Open a project file or folder.reqview validate Validate a project file or project folder.reqview importlicense Import a license file (and thereby agree to EULA); optionally add user details.
Show help for export
command:
$ reqview export --help
Show help for export docx
command:
$ reqview export docx --help
Exporting custom reports from command line can simplify tracking of issues in your custom export templates and allow you to generate reports from the latest project version stored in a version control system.
You need to import a license to be able to use this command.
When running this command, both input and output files/directories and also the current working directory should be outside of OneDrive or other synchronized directories, as these are known to cause file access issues.
Usage:
$ reqview export [format] <options...>
Commands:
reqview export custom Export a HTML, CSV or a text file using Handlebars template [default]reqview export docx Export a MS Word DOCX filereqview export xlsx Export a MS Excel XLSX filereqview export pdf Export a PDF filereqview export config Export using an export configuration
Common Options:
--project, -p Project file or project folder.--doc, -d ID of the exported document.--view, -v ID of the document table view.--linkedProjects, -l Include traceability links from linked projects.--explore Explore indirectly linked projects (choices: "upstream", "downstream").
HTML/CSV/Text Export Options:
--template, -t Export template file.--mergeDocuments, -m Export into single file.--params, -j Custom export parameters JSON file.--output, -o Output directory.
DOCX Export Options:
--template, -t Export template file.--docx-template, -x Custom DOCX/DOTX document template file.--params, -j Custom export parameters JSON file.--output, -o Output DOCX file.
XLSX Export Options:
--output, -o Output XLSX file.
PDF Export Options:
--template, -t Export template file.--mergeDocuments, -m Export into single file.--params, -j Custom export parameters JSON file.--cert, -c Digital signature certificate (.pfx or .p12 file).--pwfile, -x File containing digital signature certificate password.--output, -o Output PDF directory.
Export Configuration Options:
--name, -n Name of export configuration.--cert, -c Digital signature certificate (.pfx or .p12 file) for PDF format.--pwfile, -x File containing digital signature certificate password for PDF format.--output, -o Output file or directory.
Example: Export NEEDS document using an HTML report template into export/out directory:
$ reqview export -p reqview_demo.reqw -d NEEDS -t export/templates/HTMLReportTemplate.html -o export/out
Example: Export a DOCX file with layout and documents specified by CustomWordTemplate.docx template, with each document rendered using WordBookExportTemplate.html template:
$ reqview export docx -p reqview_demo.reqw -t export/templates/WordBookExportTemplate.html -x export/templates/CustomWordTemplate.docx -o export/out.docx
Example: Export an XLSX file with worksheets for all documents in a project:
$ reqview export xlsx -p reqview_demo.reqw -o export/out.xlsx
Example: Export NEEDS document using a PDF book template into export/out directory and digitally sign it using a PKCS#12 certificate with the password for it stored in a file:
$ reqview export pdf -p reqview_demo.reqw -d NEEDS -t export/templates/PDFBookTemplate.html -c path/to/cert.pfx -x path/to/cert_password.txt -o export/out
Example: Export NEEDS and SRS documents to separate XLSX files from a Windows batch script (.bat). Use /W
argument to wait until each export command is finished to avoid running multiple ReqView instances at the same time.
FOR %%i IN ("NEEDS", "SRS") DO START /W %reqview% export xlsx -p reqview_demo.reqw -d %%i -o out_%%i.xlsx
Example: Export NEEDS and SRS documents to separate XLSX files from a Linux bash script (.sh):
FOR i IN "NEEDS" "SRS"; DO $reqview export xlsx -p reqview_demo.reqw -d $i -o out_$i.xlsx; DONE
Example: Export NEEDS document using a custom HTML template and a JSON file with custom export parameters:
$ reqview export -p reqview_demo.reqw -d NEEDS -t CustomTemplate.html -j params.json
Usage:
$ reqview open <options>
Open Options:
--project, -p Project file or folder
Example:
$ reqview open -p path/to/project_file.reqw
or
$ reqview open -p path/to/project_folder
Usage:
$ reqview validate <options>
Validate Options:
--project, -p Project file or folder
Example:
$ reqview validate -p path/to/project_file.reqw
or
$ reqview validate -p path/to/project_folder
This command provides a way to agree to EULA, import a license file and add user details via CLI. This command only has to be run once.
Usage:
$ reqview importlicense <options>
Options:
--license, -l Path to a license file.--user, -u User name.--email, -e User email address.--company, -c User company.
Example:
$ reqview importlicense -l path/to/license.lic -u "John Smith" -e "john@company.com" -c "Company Inc."