Skip to content

Instantly share code, notes, and snippets.

@DavidPiper94
Last active October 20, 2022 05:01
Show Gist options
  • Save DavidPiper94/ec7b9883abcaa299005252d09b31e597 to your computer and use it in GitHub Desktop.
Save DavidPiper94/ec7b9883abcaa299005252d09b31e597 to your computer and use it in GitHub Desktop.
Example code for article about ArgumentParser - Defining the top level command
import ArgumentParser
import Foundation
// 1
struct CLINotes: ParsableCommand {
// 2
static let fileExtension = ".clinote"
// 3
static let configuration: CommandConfiguration = CommandConfiguration(
commandName: "clinotes",
abstract: "Manage your notes from the command line",
usage: nil,
discussion: "Create your nodes from the command-line. Each file generated with this tool has the extension \(fileExtension).",
version: "1.0.0",
shouldDisplay: true,
subcommands: [],
defaultSubcommand: nil,
helpNames: .shortAndLong
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment