Automatic set‐language subcommand to set language preferences.
Automatic •language option to run in a specific language only once.
Versioning tools
Automatic version subcommand
Automatic •use‐version option to attempt to download and temporarily use a specific version instead of the one which is installed (only for public Swift packages).
Example Usage
This example creates a tool with the following interface:
macOS • Windows • Web • Ubuntu • tvOS • iOS • Android • Amazon Linux • watchOS
Documentation
SDGCommandLine
SDGCommandLine provides tools for implementing a command line interface.
Features
help
subcommand•no‐colour
optionset‐language
subcommand to set language preferences.•language
option to run in a specific language only once.version
subcommand•use‐version
option to attempt to download and temporarily use a specific version instead of the one which is installed (only for public Swift packages).Example Usage
This example creates a tool with the following interface:
main.swift
must consist of the following:The rest can be anywhere in the project (but putting it in a separate, testable library module is recommended):
Tests are easy to set up:
Some platforms lack certain features. The compilation conditions which appear throughout the documentation are defined as follows:
Importing
SDGCommandLine provides libraries for use with the Swift Package Manager.
Simply add SDGCommandLine as a dependency in
Package.swift
and specify which of the libraries to use:The modules can then be imported in source files:
About
The SDGCommandLine project is maintained by Jeremy David Giesbrecht.
If SDGCommandLine saves you money, consider giving some of it as a donation.
If SDGCommandLine saves you time, consider devoting some of it to contributing back to the project.