This project is read-only.
Project Description
Simplified variant of "GetOpt" and "Glob" for C# programs. The goal is to get just enough functionality with minimal effort so I can focus on the tool.

--

Usage:
ExampleTool -l|--list [-t|--type d|f] [-d] <files>
List <files>.
-t|--type: d: directories only; f: files only. Default is all.
-d, --debug: Show debugging info.
Version: 01.01.0102.0

--

Version history:

01.01.0102.0:
- Refactor globbing.
- Added .AddFlag and .File to better support flags.
- Show the option that is incorrect.

01.00.0101.0:
- Initial release.

--

This program is a starting point for command line utilities written in C#.

Goals:
- Accept single character options starting with dash.
- Allow multiple single character options to be passed with a single dash.
- Accept long options with double dash.
- Options can have one or more parameters.
- Options can appear in any order.
- Options can appear multiple times.
- Allow wild card matching of multiple files in multiple directories.

Non-Goals:
- Accept slashes instead of dashes.
- A universal or highly abstract solution for parsing command lines.

Notes:
  • If you pass -d it will show the full strack trace when an exception occurs.
  • Otherwise, it will just show the exception message.
  • In the Debugger it it will prompt before exiting.
  • Directory wildcards are not currently supported when globbing.
  • I often use XARGS.EXE and FIND.EXE (hint, rename to FINDU.EXE to avoid
collision with built-in FIND) in conjunction to build very long lists
of files, e.g., findu -type f . | xargs ExampleTool -l.
See http://unxutils.sourceforge.net/ for the tools.

Examples:

ExampleTool -l C:\Windows\* C:\Windows\System32\*
-> List all the files and subdirectories in the two directories.

ExampleTool --list --type d C:\Windows\* C:\Windows\System32\*
-> List all the subdirectories in the two directories.

ExampleTool -l C:\?\*
-> Shows an exception message because directory wildcards are not supported.

ExampleTool -d --list C:\?\*
-> Shows the full stack trace of the exception.

--

Please provide feedback to improve the design.

Last edited Apr 21, 2014 at 6:01 AM by TomBallard, version 6