Skip to content

Commit

Permalink
Merge pull request #45 from bacalhau-project/fix/dup-lilypad-display
Browse files Browse the repository at this point in the history
cli: version display fixes
  • Loading branch information
DeveloperAlly authored Jan 5, 2024
2 parents bccd950 + 685b82d commit 5998449
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,14 @@ release:
go build -v -ldflags="\
-X 'github.com/bacalhau-project/lilypad/cmd/lilypad.VERSION=$$(git describe --tags --abbrev=0)' \
-X 'github.com/bacalhau-project/lilypad/cmd/lilypad.COMMIT_SHA=$$(git rev-parse HEAD)' \
" .
./lilypad version
" -o bin/
./bin/lilypad version



.PHONY: release install

install:
make release
cp ./bin/lilypad.exe $$GOBIN
#Ps1: cmd cp ./bin/lilypad.exe $env:GOBIN
10 changes: 6 additions & 4 deletions cmd/lilypad/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@ package lilypad

import (
"context"
"fmt"
"os"

"github.com/spf13/cobra"
)

var Fatal = FatalErrorHandler

func init() { //nolint:gochecknoinits
NewRootCmd()
}
//FIXME: why @Kai?
//func init() { //nolint:gochecknoinits
// NewRootCmd()
//}

func NewRootCmd() *cobra.Command {
RootCmd := &cobra.Command{
Use: getCommandLineExecutable(),
Short: "Lilypad",
Long: `Lilypad`,
Long: fmt.Sprintf("Lilypad: %s \nCommit: %s \n", VERSION, COMMIT_SHA),
}
RootCmd.AddCommand(newSolverCmd())
RootCmd.AddCommand(newResourceProviderCmd())
Expand Down
10 changes: 8 additions & 2 deletions cmd/lilypad/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"os/signal"
"strings"
"syscall"
"time"

Expand Down Expand Up @@ -41,7 +42,7 @@ func newRunCmd() *cobra.Command {

func runJob(cmd *cobra.Command, options jobcreator.JobCreatorOptions) error {
c := color.New(color.FgCyan).Add(color.Bold)
c.Print(`
header := `
⠀⠀⠀⠀⠀⠀⣀⣤⣤⢠⣤⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢴⣿⣿⣿⣿⢸⣿⡟⠀⠀⠀⠀⠀ ██╗ ██╗██╗ ██╗ ██╗██████╗ █████╗ ██████╗
⠀⠀⣰⣿⣦⡙⢿⣿⣿⢸⡿⠀⠀⠀⠀⢀⠀ ██║ ██║██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
Expand All @@ -52,7 +53,12 @@ func runJob(cmd *cobra.Command, options jobcreator.JobCreatorOptions) error {
⠀⠀⠀⠉⢾⣿⣿⣿⣿⢸⣿⣿⣿⡷⠈⠀⠀
⠀⠀⠀⠀⠀⠈⠙⠛⠛⠘⠛⠋⠁⠀ ⠀⠀⠀ Decentralized Compute Network https://lilypad.tech
`)
`
if VERSION != "" {
header = strings.Replace(header, "v2", VERSION, 1)
}
c.Print(header)

spinner, err := createSpinner("Lilypad submitting job", "🌟")
if err != nil {
fmt.Printf("failed to make spinner from config struct: %v\n", err)
Expand Down
6 changes: 6 additions & 0 deletions cmd/lilypad/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ func runVersion(cmd *cobra.Command) error {

return nil
}

//func init() {
// if VERSION == "" {
// VERSION = "v2" //TODO: @release, FIX: L41
// }
//}
4 changes: 1 addition & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main

import (
"fmt"

"github.com/bacalhau-project/lilypad/cmd/lilypad"
)

Expand All @@ -11,5 +9,5 @@ func main() {
}

func init() {
fmt.Printf("Lilypad: %s\n", lilypad.VERSION)
//fmt.Printf("Lilypad: %s\n", lilypad.VERSION)
}

0 comments on commit 5998449

Please sign in to comment.