forked from 1Password/shell-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (30 loc) · 1.08 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
plugins_dir := ~/.op/plugins/local
.PHONY: new-plugin registry %/example-secrets %/validate %/build test
beta-notice:
@echo "# BETA NOTICE: The plugin ecosystem is in beta and is subject to change."
@echo "# You may have to update or recompile your local builds every now and then to keep them"
@echo "# compatible with the 1Password CLI updates."
@echo
new-plugin: beta-notice
go run cmd/contrib/main.go $@
registry:
@rm -f plugins/plugins.go
@go run cmd/contrib/main.go $@
%/example-secrets: registry
go run cmd/contrib/main.go $@
%/validate: registry beta-notice
go run cmd/contrib/main.go $@
validate: registry
go run cmd/contrib/main.go $@
$(plugins_dir):
mkdir -p $(plugins_dir)
chmod 700 $(plugins_dir)
%/build: $(plugins_dir) registry beta-notice
$(eval plugin := $(firstword $(subst /, ,$@)))
@go run cmd/contrib/main.go $(plugin)/exists
go build -o $(plugins_dir)/$(plugin) -ldflags="-X 'main.PluginName=$(plugin)'" ./cmd/contrib/build/
test:
go test ./...
%/remove-local: beta-notice
$(eval plugin := $(firstword $(subst /, ,$@)))
rm -f ~/.op/plugins/local/$(plugin)