Skip to content

Commit

Permalink
chore: minor updates and cleanup
Browse files Browse the repository at this point in the history
- add version number to cli
- remove zsh tab completion
  • Loading branch information
slimm609 committed Oct 30, 2024
1 parent e12f4ca commit 6428a63
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 45 deletions.
21 changes: 17 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ builds:
- id: linux
binary: checksec
main: ./main.go
flags: -buildmode=pie
ldflags: -s -w
ldflags:
- -s -w
- -X "main.version={{ .Version }}"
- -X "main.commit={{ .Commit }}"
- -X "main.date={{ .Date }}"
env:
- CGO_ENABLED=0
goos:
Expand All @@ -17,8 +20,11 @@ builds:
- id: darwin
binary: checksec
main: ./main.go
flags: -buildmode=pie
ldflags: -s -w
ldflags:
- -s -w
- -X "main.version={{ .Version }}"
- -X "main.commit={{ .Commit }}"
- -X "main.date={{ .Date }}"
env:
- CGO_ENABLED=0
goos:
Expand All @@ -30,6 +36,13 @@ builds:
# - id: windows
# binary: checksec
# main: ./main.go
# ldflags:
# - -s -w
# - -X "main.version={{ .Version }}"
# - -X "main.commit={{ .Commit }}"
# - -X "main.date={{ .Date }}"
# env:
# - CGO_ENABLED=0
# goos:
# - windows
# goarch:
Expand Down
5 changes: 5 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"fmt"
"os"

"github.com/spf13/cobra"
Expand All @@ -17,6 +18,10 @@ var rootCmd = &cobra.Command{
Long: `A tool used to quickly survey mitigation technologies in use by processes on a Linux system.`,
}

func SetVersionInfo(version, commit, date string) {
rootCmd.Version = fmt.Sprintf("%s (Built on %s from Git SHA %s)", version, date, commit)
}

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
Expand Down
2 changes: 0 additions & 2 deletions extras/zsh/README.md

This file was deleted.

39 changes: 0 additions & 39 deletions extras/zsh/_checksec

This file was deleted.

7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ package main

import "github.com/slimm609/checksec/cmd"

var (
version = "dev"
commit = "none"
date = "unknown"
)

func main() {
cmd.SetVersionInfo(version, commit, date)
cmd.Execute()
}

0 comments on commit 6428a63

Please sign in to comment.