feat(version): adds --short flag to only show release information
This commit is contained in:
parent
9130c09e56
commit
59cb09a8e7
2 changed files with 18 additions and 1 deletions
15
README.md
15
README.md
|
|
@ -749,3 +749,18 @@ pda run script
|
||||||
```
|
```
|
||||||
|
|
||||||
<p align="center"></p><!-- spacer -->
|
<p align="center"></p><!-- spacer -->
|
||||||
|
|
||||||
|
### Version
|
||||||
|
|
||||||
|
`pda!` uses calendar versioning: `YYYY.WW`. ASCII art can be permanently disabled with `display_ascii_art = false` in config.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Display the full version output.
|
||||||
|
pda version
|
||||||
|
|
||||||
|
# Or just the release.
|
||||||
|
pda version --short
|
||||||
|
# pda! 2025.47 release
|
||||||
|
```
|
||||||
|
|
||||||
|
<p align="center"></p><!-- spacer -->
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ var versionCmd = &cobra.Command{
|
||||||
Use: "version",
|
Use: "version",
|
||||||
Short: "Display pda! version",
|
Short: "Display pda! version",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
if config.DisplayAsciiArt {
|
short, _ := cmd.Flags().GetBool("short")
|
||||||
|
if !short && config.DisplayAsciiArt {
|
||||||
fmt.Print(asciiArt + "\n ")
|
fmt.Print(asciiArt + "\n ")
|
||||||
}
|
}
|
||||||
fmt.Printf("%s\n", version)
|
fmt.Printf("%s\n", version)
|
||||||
|
|
@ -44,5 +45,6 @@ var versionCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
versionCmd.Flags().Bool("short", false, "Print only the version string")
|
||||||
rootCmd.AddCommand(versionCmd)
|
rootCmd.AddCommand(versionCmd)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue