Skip to content

Commit 2ee8cd3

Browse files
committed
init strucutre
1 parent f370ba9 commit 2ee8cd3

File tree

11 files changed

+309
-0
lines changed

11 files changed

+309
-0
lines changed

.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
APP_NAME=eigenlayer

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# bin directory
2+
bin

LICENSE

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
Business Source License 1.1
2+
3+
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
4+
"Business Source License" is a trademark of MariaDB Corporation Ab.
5+
6+
-----------------------------------------------------------------------------
7+
8+
Parameters
9+
10+
Licensor: Layr Labs, Inc.
11+
12+
Licensed Work: eigenlayer-cli
13+
The Licensed Work is (c) 2023 Layr Labs, Inc.
14+
15+
Additional Use Grant:
16+
17+
Change Date: 2025-11-01 (Nov 1st, 2025)
18+
19+
Change License: MIT
20+
21+
-----------------------------------------------------------------------------
22+
23+
Terms
24+
25+
The Licensor hereby grants you the right to copy, modify, create derivative
26+
works, redistribute, and make non-production use of the Licensed Work. The
27+
Licensor may make an Additional Use Grant, above, permitting limited
28+
production use.
29+
30+
Effective on the Change Date, or the fourth anniversary of the first publicly
31+
available distribution of a specific version of the Licensed Work under this
32+
License, whichever comes first, the Licensor hereby grants you rights under
33+
the terms of the Change License, and the rights granted in the paragraph
34+
above terminate.
35+
36+
If your use of the Licensed Work does not comply with the requirements
37+
currently in effect as described in this License, you must purchase a
38+
commercial license from the Licensor, its affiliated entities, or authorized
39+
resellers, or you must refrain from using the Licensed Work.
40+
41+
All copies of the original and modified Licensed Work, and derivative works
42+
of the Licensed Work, are subject to this License. This License applies
43+
separately for each version of the Licensed Work and the Change Date may vary
44+
for each version of the Licensed Work released by Licensor.
45+
46+
You must conspicuously display this License on each original or modified copy
47+
of the Licensed Work. If you receive the Licensed Work in original or
48+
modified form from a third party, the terms and conditions set forth in this
49+
License apply to your use of that work.
50+
51+
Any use of the Licensed Work in violation of this License will automatically
52+
terminate your rights under this License for the current and all other
53+
versions of the Licensed Work.
54+
55+
This License does not grant you any right in any trademark or logo of
56+
Licensor or its affiliates (provided that you may use a trademark or logo of
57+
Licensor as expressly required by this License).
58+
59+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
60+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
61+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
62+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
63+
TITLE.
64+
65+
MariaDB hereby grants you permission to use this License's text to license
66+
your works, and to refer to it using the trademark "Business Source License",
67+
as long as you comply with the Covenants of Licensor below.
68+
69+
-----------------------------------------------------------------------------
70+
71+
Covenants of Licensor
72+
73+
In consideration of the right to use this License's text and the "Business
74+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
75+
other recipients of the licensed work to be provided by Licensor:
76+
77+
1. To specify as the Change License the GPL Version 2.0 or any later version,
78+
or a license that is compatible with GPL Version 2.0 or a later version,
79+
where "compatible" means that software provided under the Change License can
80+
be included in a program with software provided under GPL Version 2.0 or a
81+
later version. Licensor may specify additional Change Licenses without
82+
limitation.
83+
84+
2. To either: (a) specify an additional grant of rights to use that does not
85+
impose any additional restriction on the right granted in this License, as
86+
the Additional Use Grant; or (b) insert the text "None".
87+
88+
3. To specify a Change Date.
89+
90+
4. Not to modify this License in any other way.
91+
92+
-----------------------------------------------------------------------------
93+
94+
Notice
95+
96+
The Business Source License (this document, or the "License") is not an Open
97+
Source license. However, the Licensed Work will eventually be made available
98+
under an Open Source License, as stated in this License.

Makefile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
include .env
2+
3+
.DEFAULT_GOAL := help
4+
.PHONY: build help
5+
6+
build: ## Compile the binary
7+
@mkdir -p bin
8+
@go build -o bin/$(APP_NAME) cmd/$(APP_NAME)/main.go
9+
10+
help: ## Show this help
11+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

cmd/eigenlayer/main.go

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"github.com/Layr-Labs/eigenlayer-cli/operator"
6+
"github.com/urfave/cli/v2"
7+
"os"
8+
)
9+
10+
func main() {
11+
var app = cli.NewApp()
12+
13+
app.Name = "eigenlayer"
14+
app.Usage = "EigenLayer CLI"
15+
app.Version = "0.1.0"
16+
app.Commands = append(app.Commands, operator.KeysCmd())
17+
18+
if err := app.Run(os.Args); err != nil {
19+
_, err := fmt.Fprintln(os.Stderr, err)
20+
if err != nil {
21+
return
22+
}
23+
os.Exit(1)
24+
}
25+
}

go.mod

+29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
11
module github.com/Layr-Labs/eigenlayer-cli
22

33
go 1.21.0
4+
5+
require (
6+
github.com/charmbracelet/bubbles v0.16.1
7+
github.com/charmbracelet/bubbletea v0.24.2
8+
github.com/urfave/cli/v2 v2.25.7
9+
)
10+
11+
require (
12+
github.com/atotto/clipboard v0.1.4 // indirect
13+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
14+
github.com/charmbracelet/lipgloss v0.7.1 // indirect
15+
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
16+
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
17+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
18+
github.com/mattn/go-isatty v0.0.18 // indirect
19+
github.com/mattn/go-localereader v0.0.1 // indirect
20+
github.com/mattn/go-runewidth v0.0.14 // indirect
21+
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect
22+
github.com/muesli/cancelreader v0.2.2 // indirect
23+
github.com/muesli/reflow v0.3.0 // indirect
24+
github.com/muesli/termenv v0.15.1 // indirect
25+
github.com/rivo/uniseg v0.2.0 // indirect
26+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
27+
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
28+
golang.org/x/sync v0.1.0 // indirect
29+
golang.org/x/sys v0.6.0 // indirect
30+
golang.org/x/term v0.6.0 // indirect
31+
golang.org/x/text v0.3.8 // indirect
32+
)

go.sum

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
2+
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
3+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
4+
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
5+
github.com/charmbracelet/bubbles v0.16.1 h1:6uzpAAaT9ZqKssntbvZMlksWHruQLNxg49H5WdeuYSY=
6+
github.com/charmbracelet/bubbles v0.16.1/go.mod h1:2QCp9LFlEsBQMvIYERr7Ww2H2bA7xen1idUDIzm/+Xc=
7+
github.com/charmbracelet/bubbletea v0.24.2 h1:uaQIKx9Ai6Gdh5zpTbGiWpytMU+CfsPp06RaW2cx/SY=
8+
github.com/charmbracelet/bubbletea v0.24.2/go.mod h1:XdrNrV4J8GiyshTtx3DNuYkR1FDaJmO3l2nejekbsgg=
9+
github.com/charmbracelet/lipgloss v0.7.1 h1:17WMwi7N1b1rVWOjMT+rCh7sQkvDU75B2hbZpc5Kc1E=
10+
github.com/charmbracelet/lipgloss v0.7.1/go.mod h1:yG0k3giv8Qj8edTCbbg6AlQ5e8KNWpFujkNawKNhE2c=
11+
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY=
12+
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
13+
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
14+
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
15+
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
16+
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
17+
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
18+
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
19+
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
20+
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
21+
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
22+
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
23+
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
24+
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b h1:1XF24mVaiu7u+CFywTdcDo2ie1pzzhwjt6RHqzpMU34=
25+
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho=
26+
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
27+
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
28+
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
29+
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
30+
github.com/muesli/termenv v0.15.1 h1:UzuTb/+hhlBugQz28rpzey4ZuKcZ03MeKsoG7IJZIxs=
31+
github.com/muesli/termenv v0.15.1/go.mod h1:HeAQPTzpfs016yGtA4g00CsdYnVLJvxsS4ANqrZs2sQ=
32+
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
33+
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
34+
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
35+
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
36+
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
37+
github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs=
38+
github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
39+
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
40+
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
41+
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
42+
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
43+
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
44+
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
45+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
46+
golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw=
47+
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
48+
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
49+
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=

operator/keys.go

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package operator
2+
3+
import (
4+
"github.com/Layr-Labs/eigenlayer-cli/operator/keys"
5+
"github.com/urfave/cli/v2"
6+
)
7+
8+
func KeysCmd() *cli.Command {
9+
var keysCmd = &cli.Command{
10+
Name: "keys",
11+
Usage: "Manage the operator's keys",
12+
Subcommands: []*cli.Command{
13+
keys.CreateCmd,
14+
},
15+
}
16+
17+
return keysCmd
18+
19+
}

operator/keys/create.go

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package keys
2+
3+
import (
4+
"fmt"
5+
"github.com/Layr-Labs/eigenlayer-cli/utils/prompts"
6+
"github.com/urfave/cli/v2"
7+
)
8+
9+
var CreateCmd = &cli.Command{
10+
Name: "create",
11+
Action: Create,
12+
}
13+
14+
func Create(ctx *cli.Context) error {
15+
password := prompts.GetPasswordModel()
16+
fmt.Println(password.View())
17+
return nil
18+
}

utils/prompt.go

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package utils

utils/prompts/password.go

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package prompts
2+
3+
import (
4+
"github.com/charmbracelet/bubbles/textinput"
5+
tea "github.com/charmbracelet/bubbletea"
6+
)
7+
8+
type (
9+
errMsg error
10+
)
11+
12+
type PasswordModel struct {
13+
textInput textinput.Model
14+
err error
15+
}
16+
17+
func GetPasswordModel() *PasswordModel {
18+
ti := textinput.New()
19+
ti.Placeholder = "Pikachu"
20+
ti.Focus()
21+
ti.CharLimit = 156
22+
ti.Width = 20
23+
24+
return &PasswordModel{
25+
textInput: ti,
26+
err: nil,
27+
}
28+
}
29+
30+
func (m PasswordModel) Init() tea.Cmd {
31+
return textinput.Blink
32+
}
33+
34+
func (m PasswordModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
35+
var cmd tea.Cmd
36+
37+
switch msg := msg.(type) {
38+
case tea.KeyMsg:
39+
switch msg.Type {
40+
case tea.KeyEnter, tea.KeyCtrlC, tea.KeyEsc:
41+
return m, tea.Quit
42+
}
43+
44+
// We handle errors just like any other message
45+
case errMsg:
46+
m.err = msg
47+
return m, nil
48+
}
49+
50+
m.textInput, cmd = m.textInput.Update(msg)
51+
return m, cmd
52+
}
53+
54+
func (m PasswordModel) View() string {
55+
return m.textInput.View()
56+
}

0 commit comments

Comments
 (0)