Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

ethanKletschke/Perl-Command-Line-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Perl Command Line Parser v1.2.1

A test script written in Perl to parse command line arguments and output different things depending on the option entered.

  • Author: Ethan Kletschke
  • Version: 1.2.2 (DEPRECATED)
  • Developed on: Windows 11
  • License: MIT

DEPRECATED!!

This project is now deprecated. No further updates will happen unless someone else takes over.

Table of Contents

Description

The Perl Command Line Parser is a simple command-line interface (CLI) app (esssentially just a test script) that parses command line arguments passed to the program. It is only intended to be a skills reference, and as a test to see how the Perl language works when used for a simple software application.

Options

The table below lists the currently-implemented valid command-line arguments:

Option Description
-v/--version Displays version information.
-h/--help Help menu. Also displays on incorrect CLI input (see here).
-Dall Short for Display all. Turns on "verbosity mode", which displays both debug messages and warnings.
-Dbug Short for Display debug. Turns on debugging messages.
-Dwarn Short for Display warnings. Turns on warning messages.

(Table generated with TablesGenerator.com)

Planned options

The table below lists the planned options that could be implemented in later versions of this "app":

Option Description Planned Version*
-m "Literal" Displays the string "Literal" that comes immediately after the -m flag. 1.3
--message "Literal" Alias of -m. 1.3
-l Log the output to a file. 1.3
--log Alias of -l 1.3
-s Save output to a file(?). ???
--save Alias of -s. ???

* - Not 100% accurate.

(Table generated with TablesGenerator.com)

Incorrect CLI Input

Single-line Flag Entered with Other Flags

If the user enters a single-output option (such as -v or -h) along with more than one option, then the program will close with an error message.

"Single-line Flag not Entered" Error

Or if the user enters a normal flag (such as -Dall) as the only option (as of v1.1), the program will close with an error message.

For example:

perl Main.pl -Dall

Will show the following output (as of v1.1):

Single-line flag not entered.
Exiting...

Changelog

1.2.2

  • Documentation updates:
    • Add MIT LICENSE file.
    • Tweak README.md

1.2.1

Stop working on project.

1.2.0

  • Implementation Tweaks:
    • Add more comments.
    • Tweak flag setting:
      • Set all flags at once when testing for multiple flags, i.e. setting $verbose and unsetting the other flags.

1.1.0

New Features:

  • Allow --version to be used as an alias of -v.
  • Allow --help to be used as an alias of -h.

Implementation Tweaks:

  • Re-ordered the $help string's list to show single-line flags first.

Bug fixes:

  • Tweaked if statements to actually allow for warning outputs to be enabled.
  • Tweaked single-argument handling a bit.
    • Temporarily use the die keyword to kill the program when a single-line flag is not entered.
      • To be fixed in a future release.
  • Fix README.md

1.0

Program is initially released onto Github.

About

A command-line parsing Perl script. Deprecated. For skills reference only.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages