Initial project
This commit is contained in:
commit
e715024cbd
23 files changed
+1547
No files matched your search
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright © 2026 Craig Williams <craig@avsdev.uk>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package version
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"git.avsdev.uk/Go/job-search/internal/version"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print version information",
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
slog.Debug("version.PersistentPreRun")
|
||||
},
|
||||
PersistentPostRun: func(cmd *cobra.Command, args []string) {
|
||||
slog.Debug("version.PersistentPostRun")
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
slog.Debug("version.Run")
|
||||
|
||||
fmt.Printf("PBCNinja - %s\n", version.Version)
|
||||
if version.BuildTime != "unknown" {
|
||||
fmt.Printf("Built: %s\n", version.BuildTime)
|
||||
}
|
||||
if version.GitCommit != "unknown" {
|
||||
fmt.Printf("Commit: %s\n", version.GitCommit)
|
||||
}
|
||||
},
|
||||
Annotations: map[string]string{
|
||||
"no_config": "1",
|
||||
"terminal_log": "1",
|
||||
},
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
Reference in new issue
Block a user