Skip to content

Commit

Permalink
Testing build vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelloeater committed Sep 1, 2024
1 parent 517eb8a commit e19c1e1
Showing 1 changed file with 36 additions and 8 deletions.
44 changes: 36 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ import (
"log"
"log/slog"
"os"
"os/exec"
"time"
)

var ( // Create by GoRelease at compile time
version = "dev"
commit = "none"
//date = "unknown"
)

func writeDate(format string, timezone string) {

loc, e := time.LoadLocation(timezone)
Expand All @@ -26,14 +31,12 @@ func writeDate(format string, timezone string) {
}

func mainCliApp() error {
gitSHA, _ := exec.Command("git", "rev-parse", "HEAD").Output()

app := &cli.App{
Name: "stampy",
Version: string(gitSHA),
Description: "Copy formatted timestamp to system clipboard",
Compiled: time.Time{},

Name: "stampy",
Usage: "Copy formatted timestamp to system clipboard",
Args: true,
Version: "v" + version + " build " + commit,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "format",
Expand All @@ -46,14 +49,39 @@ func mainCliApp() error {
Usage: "Timezone",
},
},

EnableBashCompletion: false,
HideHelp: false,
HideHelpCommand: false,
HideVersion: false,
BashComplete: nil,
Before: nil,
After: nil,
Action: func(c *cli.Context) error {
format := c.String("format")
timezone := c.String("timezone")
writeDate(format, timezone)

return nil
},
CommandNotFound: nil,
OnUsageError: nil,
InvalidFlagAccessHandler: nil,
Compiled: time.Time{}.UTC(),
Authors: nil,
Copyright: "",
Reader: nil,
Writer: nil,
ErrWriter: nil,
ExitErrHandler: nil,
Metadata: nil,
ExtraInfo: nil,
CustomAppHelpTemplate: "",
SliceFlagSeparator: "",
DisableSliceFlagSeparator: false,
UseShortOptionHandling: false,
Suggest: false,
AllowExtFlags: false,
SkipFlagParsing: false,
}

// Run App and return value
Expand Down

0 comments on commit e19c1e1

Please sign in to comment.