@mgi/console

The MGI Windows Console API Provides an easy interface to the windows console. This allows command line based LabVIEW applications to write directly to read from standard input, write to standard out, specify exit codes.

Usage

Console

When your application first starts, call Console.vi to acquire the console.

Now you can use the utility methods such as Write Line.vi, Read Line, Prompt.vi, etc to interact with the user at the console.

When your application is complete, use Close.vi to exit and set the return code.

Argument Parser

The argument parser helps developers quickly parse command line arguments. The class provides an API to read flags and settings from the command line. It also provides a framework for generating descriptive arugment documentation.s

Important Note

By default, the LabVIEW runtime engine releases the console before your application code has even started. That means the order of operations for a CLI application is:

  1. The User runs your exe from the command line.
  2. The LabVIEW runtime engine release the console. This causes your user's console to move on.
  3. Your application starts and this API re-grabs the console
  4. You write/read from the console
  5. Your application releases the console again.

This can cause an awkward user experience, as the console seems to reset before your application has completed.

To work around this, just wrap your application with a batch file. When the application is called from the batch file the console behaves as expected.

For example, to call Application.exe I would create Application.bat:

@echo off
"Application.exe" %*

This would launch the application and pass any arguments from the batch file to the application.

Contributing

See Contributing.md for information on how to submit pull requests. Bugs can be reported using the repositories issue tracker.

This package is implemented with LabVIEW 2017

0.3.0

Added Arugment Parser

0.3.0

Added Current Working Directory

0.2.1

Updated Readme.

0.2.0

Added password prompt Changed prompts to no longer use newline.

0.1.0

Initial Release

Copyright (c) 2018 Moore Good Ideas, Inc . All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

   2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

   3. Neither the name of  Moore Good Ideas, Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
How do I use this package?
Published by DerekMGI 5 years ago
0.4.0 is the latest release
BSD-3-Clause
gitlab.com/mgi/gpm-packages/console
Stats
41 downloads.
Keywords
Dependencies (0)
    none