# Customisation of swift argumentparser's help output and error output

**URL:** <https://forums.swift.org/t/customisation-of-swift-argumentparsers-help-output-and-error-output/82088>\
**Category:** ArgumentParser\
**Created:** [September 12, 2025, 4:52am UTC](https://forums.swift.org/t/customisation-of-swift-argumentparsers-help-output-and-error-output/82088 "2025-09-12T04:52:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prsinghgit](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/prsinghgit/32/42809_2.png) [@prsinghgit](https://forums.swift.org/u/prsinghgit)\
**Post date:** [September 12, 2025, 4:52am UTC](https://forums.swift.org/t/customisation-of-swift-argumentparsers-help-output-and-error-output/82088/1 "2025-09-12T04:52:01Z")

</div>

Hello I want to implement customisation to swift argumentparser, Here are following changes want to do it in my cli

1. changing default footer present in help command output

currently help command output coming like this

```swift
OVERVIEW: clisample
USAGE: clisample <subcommand>
 
OPTIONS:
  --version show the version.
  -h, --help show the help.
 
SUBCOMMANDS:
  logs (default) Export logs for clisample processes.
 
See 'clisample --help' for more information.'`

```

so instead of `See 'clisample --help' for more information.'` I want `For more details, run 'clisample help <subcommand>'`

1. customise error string getting from validation error

currently output of error

```swift
Error: Missing value for '-t <time>
Help: -t <time> Time window (e.g. 10h, 30m, 2d).
Usage: clisample logs --time <time>
 
  See 'clisample logs --help' for more information.

```

so I want error output with example and customised footer, like this

```swift
Error: Missing value for '-t <time>'
	Help: -t <time> Time window (e.g. 10h, 30m, 2d).
	Usage: clisample logs --time <time> 
	Example: clisample logs -t 5m
	 
	  For more details, run 'clisample help <subcommand>'

```

If this feature is already available, please guide me, as i haven't seen anything on forums and any other place

---

<div class="post-metadata">

**Author:** ![nnnnnnnn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/nnnnnnnn/32/264_2.png) [@nnnnnnnn](https://forums.swift.org/u/nnnnnnnn)\
**Post date:** [September 12, 2025, 7:09pm UTC](https://forums.swift.org/t/customisation-of-swift-argumentparsers-help-output-and-error-output/82088/2 "2025-09-12T19:09:18Z")

</div>

That level of customization isn't currently present in `ArgumentParser`. To support that we would probably need some kind of templating system, which isn't part of the library.

That said, you can intercept all the help and error output if you implement your own `@main` type. The `static func main()` implementation is fairly simple ([you can copy from here](https://github.com/apple/swift-argument-parser/blob/main/Sources/ArgumentParser/Parsable%20Types/AsyncParsableCommand.swift#L37-L48)) and you could post-process the error text by passing any errors you catch to your command's `fullMessage(for:)` method:

[https://swiftpackageindex.com/apple/swift-argument-parser/1.6.1/documentation/argumentparser/parsablearguments/fullmessage(for:columns:)](https://swiftpackageindex.com/apple/swift-argument-parser/1.6.1/documentation/argumentparser/parsablearguments/fullmessage(for:columns:))

---

<div class="post-metadata">

**Author:** ![robert.ryan](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/robert.ryan/32/38339_2.png) [@robert.ryan](https://forums.swift.org/u/robert.ryan)\
**Post date:** [September 12, 2025, 9:10pm UTC](https://forums.swift.org/t/customisation-of-swift-argumentparsers-help-output-and-error-output/82088/3 "2025-09-12T21:10:47Z")

</div>

Some alternatives have been suggested in response to your [prior question](https://forums.swift.org/t/argument-parser-s-help-and-error-interception/82074).

---

<div class="post-metadata">

**Author:** ![prsinghgit](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/prsinghgit/32/42809_2.png) [@prsinghgit](https://forums.swift.org/u/prsinghgit)\
**Post date:** [September 14, 2025, 3:11pm UTC](https://forums.swift.org/t/customisation-of-swift-argumentparsers-help-output-and-error-output/82088/4 "2025-09-14T15:11:57Z")

</div>

I know this way to customise description of version and help present in help command is below, so by default it is like this

> OPTIONS:  
> --version show the version.  
> -h, --help show the help.

> **struct** CliSample: ParsableCommand {
> 
> ```swift
> **static**  **let** configuration = CommandConfiguration(
> 
> ```
> 
> abstract: "CliSample",  
> subcommands: [command1. **self** , command2. **self** , command3. **self** , command4. **self**]  
> defaultSubcommand: command1. **self** ,  
> helpNames:
> 
> ```swift
> )
> 
> ```
> 
> @FlagFlag(name: .shortandlong, help: “customised help string“)  
> var help: Bool = fal@Flage
> 
> @Flag(name: .shortandlong, help: “customised version string“)  
> var version: Bool = false
> 
> }

is my way is right or any other feasible way is present
