Skip to content

Commit

Permalink
Merge pull request #5 from noahstreller/build-action-patch
Browse files Browse the repository at this point in the history
  • Loading branch information
noahstreller authored Aug 27, 2024
2 parents 6b50c3f + a8a1aed commit 2ac3b0b
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 23 deletions.
79 changes: 64 additions & 15 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,77 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go
name: Lint, build and upload Igitt

on:
push:
branches: [ "main" ]
branches: ["main"]
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.23"

- name: Lint
run: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run
test:
needs: lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.23"

- name: Test
run: go test -v ./...

build:
needs: [lint, test]
runs-on: ubuntu-latest

strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.23"

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
- name: Set GOOS and GOARCH
run: |
echo "GOOS=${{ matrix.goos }}" >> $GITHUB_ENV
echo "GOARCH=${{ matrix.goarch }}" >> $GITHUB_ENV
- name: Build
run: go build -v ./...
- name: Build
run: |
if [[ "${{ matrix.goos }}" == "windows" ]]; then \
go build -v -o out/igitt.exe ./cmd/igitt; \
else \
go build -v -o out/igitt ./cmd/igitt; \
fi
- name: Test
run: go test -v ./...
- name: Upload Build Artifact
uses: actions/[email protected]
with:
name: igitt-${{ matrix.goos }}-${{ matrix.goarch }}
path: |
out/igitt*
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.23
require (
github.com/charmbracelet/huh v0.5.2
github.com/charmbracelet/lipgloss v0.12.1
github.com/fatih/color v1.17.0
github.com/rivo/uniseg v0.4.7
github.com/spf13/cobra v1.8.1
)
Expand All @@ -22,7 +23,6 @@ require (
github.com/charmbracelet/x/windows v0.1.2 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand Down
3 changes: 1 addition & 2 deletions internal/operations/interactive/interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/noahstreller/igitt/internal/operations/git"
"github.com/noahstreller/igitt/internal/utilities/logger"
"github.com/rivo/uniseg"
"github.com/spf13/cobra"

_ "embed"
)
Expand Down Expand Up @@ -92,7 +91,7 @@ func getLinkIcon(variant IconType) string {
return ""
}

func StartInteractive(rootCmd *cobra.Command) {
func StartInteractive() {
var commands []Command

commandFlowResult := CommandFlowResult{
Expand Down
15 changes: 10 additions & 5 deletions internal/utilities/initialize/commands.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package initialize

import (
"fmt"
"os"

"github.com/fatih/color"
"github.com/noahstreller/igitt/internal/operations"
"github.com/noahstreller/igitt/internal/operations/git"
"github.com/noahstreller/igitt/internal/operations/interactive"
Expand All @@ -13,7 +15,7 @@ import (
func InitializeIgitt() {
var rootCmd = &cobra.Command{
Use: "igitt",
Short: "Igitt is a supercharged Git client with a CLI.",
Short: "Igitt is an interactive Git client with a CLI.",
Long: `Igitt supercharges your Git experience with an interactive CLI. Designed to enhance learning and streamline workflows, it offers detailed command descriptions and efficient shortcuts for a faster, more intuitive Git journey.`,
Run: func(cmd *cobra.Command, args []string) {
logger.InfoLogger.Println("igitt was called without arguments")
Expand Down Expand Up @@ -78,7 +80,7 @@ func InitializeIgitt() {
Short: "(i) Enter interactive mode",
Aliases: []string{"i"},
Run: func(cmd *cobra.Command, args []string) {
interactive.StartInteractive(rootCmd)
interactive.StartInteractive()
},
}

Expand All @@ -93,8 +95,8 @@ func InitializeIgitt() {

cobra.OnInitialize(func() {
if len(os.Args) == 1 {
rootCmd.Help()
os.Exit(0)
fmt.Println(color.RedString("No arguments provided."))
// interactive.StartInteractive()
}
})

Expand All @@ -108,5 +110,8 @@ func InitializeIgitt() {
commitCmd,
createAliasScripts,
)
rootCmd.Execute()
err := rootCmd.Execute()
if err != nil {
logger.ErrorLogger.Fatal(err)
}
}

0 comments on commit 2ac3b0b

Please sign in to comment.