mirror of
https://gitlab.melroy.org/melroy/fediresolve.git
synced 2025-06-07 11:58:55 +00:00
Add version
This commit is contained in:
parent
89e6420aee
commit
795a95e573
1 changed files with 13 additions and 1 deletions
14
cmd/root.go
14
cmd/root.go
|
@ -10,14 +10,22 @@ import (
|
||||||
"gitlab.melroy.org/melroy/fediresolve/resolver"
|
"gitlab.melroy.org/melroy/fediresolve/resolver"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const Version = "1.0"
|
||||||
|
|
||||||
|
var versionFlag bool
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "fediresolve [url|handle]",
|
Use: "fediresolve [url|handle]",
|
||||||
Short: "Resolve and display Fediverse content",
|
Short: "Resolve and display Fediverse content (v" + Version + ")",
|
||||||
Long: `Fediresolve is a CLI tool that resolves Fediverse URLs and handles.
|
Long: `Fediresolve is a CLI tool that resolves Fediverse URLs and handles.
|
||||||
|
|
||||||
It can parse and display content from Mastodon, Mbin, Lemmy, and other Fediverse platforms.
|
It can parse and display content from Mastodon, Mbin, Lemmy, and other Fediverse platforms.
|
||||||
The tool supports both direct URLs to posts/comments/threads and Fediverse handles like @username@server.com.`,
|
The tool supports both direct URLs to posts/comments/threads and Fediverse handles like @username@server.com.`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
if versionFlag {
|
||||||
|
fmt.Println("fediresolve version", Version)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
var input string
|
var input string
|
||||||
|
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
|
@ -45,6 +53,10 @@ The tool supports both direct URLs to posts/comments/threads and Fediverse handl
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.PersistentFlags().BoolVar(&versionFlag, "version", false, "Print the version number and exit")
|
||||||
|
}
|
||||||
|
|
||||||
// Execute adds all child commands to the root command and sets flags appropriately.
|
// Execute adds all child commands to the root command and sets flags appropriately.
|
||||||
func Execute() error {
|
func Execute() error {
|
||||||
return rootCmd.Execute()
|
return rootCmd.Execute()
|
||||||
|
|
Loading…
Add table
Reference in a new issue