Skip to content

Commit

Permalink
Update RELEASE-NOTES.md
Browse files Browse the repository at this point in the history
  • Loading branch information
remkop authored Dec 17, 2017
1 parent 2cf3911 commit 0ab935a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ Picocli follows [semantic versioning](http://semver.org/).

### New `@ParentCommand` annotation

In command line applications with subcommands, options of the top level command are often intended as "global" options that apply to all the subcommands. Prior to this release, subcommands had no easy way to access their parent command options unless the parent command somehow made these values available in a global variable.
In command line applications with subcommands, options of the top level command are often intended as "global" options that apply to all the subcommands. Prior to this release, subcommands had no easy way to access their parent command options unless the parent command made these values available in a global variable.

The `@ParentCommand` annotation makes it easy for subcommands to access their parent command options: subcommand fields annotated with `@ParentCommand` are initialized with a reference to the parent command. For example:

```
@Command(name = "fileutils", subcommands = List.class)
class FileUtils {
@Option(names = {"-d", "--directory"}, description = "this option applies to all subcommands")
@Option(names = {"-d", "--directory"},
description = "this option applies to all subcommands")
File baseDirectory;
}
Expand Down

0 comments on commit 0ab935a

Please sign in to comment.