Skip to content

Commit 416b946

Browse files
committed
Homebrew formula
1 parent 21c965f commit 416b946

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

Formula/qault.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class Qault < Formula
2+
desc "CLI password manager hardened for post-quantum crypto"
3+
homepage "https://github.com/klevo/qault"
4+
url "https://github.com/klevo/qault.git", branch: "main"
5+
version "0.0.0"
6+
license "MIT"
7+
head "https://github.com/klevo/qault.git", branch: "main"
8+
9+
depends_on "go" => :build
10+
11+
def install
12+
ldflags = %W[
13+
-s -w
14+
-X qault/internal/cli.Version=#{version}
15+
]
16+
system "go", "build", *std_go_args(ldflags: ldflags.join(" ")), "./cmd/qault"
17+
end
18+
19+
test do
20+
assert_match version.to_s, shell_output("#{bin}/qault version").strip
21+
end
22+
end

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ Personal, post-quantum-conscious keychain/password manager written in Go using s
44

55
This project is not intended for production use and is published for research purposes only.
66

7+
## 🧭 Installation (macOS)
8+
9+
Install via Homebrew:
10+
11+
```sh
12+
brew install klevo/qault/qault
13+
```
14+
715
## 🔍 Motivation
816

917
I want a simple replacement for cloud-based password managers from big vendors. I’d like to recover access to all my services even if I lose every device, by remembering one master password and reaching a remote Git repository.

internal/cli/cli.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ type CLI struct {
6161
}
6262

6363
var timeNow = time.Now
64+
var Version = "dev"
6465

6566
func NewDefault() *CLI {
6667
return &CLI{
@@ -123,6 +124,9 @@ func (c *CLI) dispatch(args []string) error {
123124
return c.handleList()
124125
case "change-master-password":
125126
return c.handleChangeMasterPassword()
127+
case "version":
128+
fmt.Fprintln(c.Out, Version)
129+
return nil
126130
default:
127131
return c.handleFetchArgs(args)
128132
}

internal/cli/cli_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,25 @@ func pop(values *[]string) (string, error) {
4949
return v, nil
5050
}
5151

52+
func TestVersion(t *testing.T) {
53+
var out bytes.Buffer
54+
var err bytes.Buffer
55+
56+
c := &CLI{
57+
Out: &out,
58+
Err: &err,
59+
Prompter: &fakePrompter{},
60+
}
61+
62+
exit := c.Run([]string{"version"})
63+
if exit != 0 {
64+
t.Fatalf("expected exit 0, got %d (stderr: %q)", exit, err.String())
65+
}
66+
if out.String() == "" {
67+
t.Fatalf("expected version output")
68+
}
69+
}
70+
5271
func runCommand(t *testing.T, dataDir string, prompter Prompter, args ...string) (int, string, string) {
5372
t.Helper()
5473

0 commit comments

Comments
 (0)