Skip to content

Commit 07f437b

Browse files
authored
Merge branch '1Password:main' into akamai-plugin
2 parents 221c37f + 6b0ac07 commit 07f437b

25 files changed

+1445
-213
lines changed

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,20 @@ make <plugin>/example-secrets
8888
```
8989

9090
<!----><a name="get-in-touch"></a>
91+
92+
## 📄 Documentation
93+
94+
No documentation work is required on your end. If your plugin is accepted, a technical writer on our team will publish [a guide to using your plugin](https://developer.1password.com/docs/cli/shell-plugins) when the plugin is added to 1Password CLI. You can help the technical writing team by:
95+
- Making note in your PR of anything unique to your shell plugin that might need to be documented beyond our standard template.
96+
- Including an example command that requires authentication for us to use in our testing and screenshots.
97+
9198
## 💬 Get In Touch
9299

93100
If you need help, found a bug, or have an idea for an awesome plugin that you'd like to discuss with us first, you can reach out to us here:
94101

95102
* Create an [issue](https://github.com/1Password/shell-plugins/issues) in this repo.
96103
* Join the [Developer Slack workspace](https://join.slack.com/t/1password-devs/shared_invite/zt-1halo11ps-6o9pEv96xZ3LtX_VE0fJQA).
104+
105+
## 📣 Contributions Beta Notice
106+
107+
The 1Password Shell Plugins ecosystem is still in beta. In practice, this means that if you're building your own plugins locally, you'll likely have to recompile them on occasion to keep up with the latest updates of the 1Password CLI.

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
plugins_dir := ~/.op/plugins/local
1+
config_dir := $(shell go run cmd/contrib/scripts/config_dir_getter.go)
2+
plugins_dir := ${config_dir}/plugins/local
23

34
.PHONY: new-plugin registry %/example-secrets %/validate %/build test
45

@@ -27,8 +28,8 @@ validate: registry
2728
$(plugins_dir):
2829
mkdir -p $(plugins_dir)
2930
chmod 700 $(plugins_dir)
30-
chmod 700 ~/.op
31-
chmod 700 ~/.op/plugins
31+
chmod 700 ${config_dir}
32+
chmod 700 ${config_dir}/plugins
3233

3334
%/build: $(plugins_dir) registry beta-notice
3435
$(eval plugin := $(firstword $(subst /, ,$@)))

README.md

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,70 @@
1+
<p align="center">
2+
<img src="https://user-images.githubusercontent.com/45081667/227194559-57c73a9e-51df-4d42-b9f0-8b6dd011ae7b.png" alt="Header" >
3+
</p>
4+
15
<p align="center">
26
<a href="https://1password.com">
3-
<img alt="1Password logo" src="https://user-images.githubusercontent.com/7430639/205342015-46801fd8-6701-482f-9da9-e21e7e39b3a1.svg" height="64">
4-
<h3 align="center">1Password Shell Plugins</h3>
7+
<h3 align="center">1Password Shell Plugins</h3>
58
</a>
69
</p>
710

811
<p align="center">
9-
Seamless authentication for every tool in your terminal. <sup><b><a href="#-beta-notice">[BETA]</a></b></sup>
12+
<h5 align="center"> Authenticate any CLI with your fingerprint </h5>
1013
</p>
1114

1215
<p align="center">
13-
<a href="https://developer.1password.com/docs/cli/shell-plugins"><b>Available plugins</b></a> ·
14-
<a href="https://developer.1password.com/docs/cli/"><b>1Password CLI docs</b></a> ·
15-
<a href="https://developer.1password.com/docs/cli/shell-plugins/contribute"><b>Contribution docs</b></a>
16+
<a href="https://developer.1password.com/docs/cli/shell-plugins/"><img alt="Get Started" src="https://user-images.githubusercontent.com/45081667/226940040-16d3684b-60f4-4d95-adb2-5757a8f1bc15.png" height="37" /></a>
17+
<a href="https://developer.1password.com/docs/cli/shell-plugins/contribute"><img alt="Build" src="https://user-images.githubusercontent.com/45081667/229808294-5a5e5840-6bbb-481c-8b3c-836d7958c1ee.png" height="37" /></a>
1618
</p>
1719
<br/>
1820

1921
---
2022

2123
No more plaintext credentials in your home directory. Automatically authenticate every CLI you use with [1Password CLI](https://developer.1password.com/docs/cli/) + [Shell Plugins](https://developer.1password.com/docs/cli/shell-plugins/). Approve temporary credential usage in your terminal with biometrics.
2224

23-
## 🪄 Usage
24-
25-
<picture>
26-
<source srcset="https://developer.1password.com/videos/aws.webp" type="image/webp" />
27-
<img src="https://user-images.githubusercontent.com/7430639/205337855-41604aca-0ddb-4eab-a5f0-fb9107e09d8d.gif" alt="Example of 1Password Shell Plugins with AWS: user runs an `aws` command, a Touch ID prompt shows up, and `aws` is automatically authenticated" style="max-width: 100%; display: inline-block;" />
25+
## 🪄 See it in action!
26+
<p align="center">
27+
<picture>
28+
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/45081667/227191964-9629476d-a49e-475d-b8cb-2115c302025d.gif">
29+
<img src="https://user-images.githubusercontent.com/45081667/229802932-d3a5de19-82f1-43bf-825d-befcc649ed29.gif" alt="Example of 1Password Shell Plugins with AWS: user runs an `aws` command, a Touch ID prompt shows up, and `aws` is automatically authenticated" style="max-width: 100%; display: inline-block;" />
2830
</picture>
31+
</p>
32+
33+
[//]: # (https://user-images.githubusercontent.com/45081667/229796312-cfacfbb8-fde2-4f5e-975e-83253127adeb.gif)
34+
## 🚀 Get started with the available plugins
35+
36+
<p align="center">
37+
<a href="https://developer.1password.com/docs/cli/shell-plugins/">
38+
<picture>
39+
40+
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/45081667/226968760-70d3f6b0-a3eb-4c75-a674-6fd136d7149a.png">
2941

30-
## 🚀 Get started
42+
<img alt="Picture changing depending on light mode." src="https://user-images.githubusercontent.com/45081667/226969008-0a3f7537-7942-442f-9170-18b008a6574c.png">
3143

32-
* Get started with [1Password Shell Plugins](https://developer.1password.com/docs/cli/shell-plugins)
33-
* Get started with [creating your own plugins](https://developer.1password.com/docs/cli/shell-plugins/contribute) <sup><b>[BETA]</b></sup>
44+
</picture>
45+
<br>
46+
See all...
47+
</a>
48+
</p>
3449

35-
## 👫 Contributing
50+
<br/>
3651

37-
Is your favorite CLI not listed yet? Learn how to [build a shell plugin](https://developer.1password.com/docs/cli/shell-plugins/contribute) yourself and [open a PR](https://github.com/1Password/shell-plugins/pulls)!
52+
## 🔩 Don’t see yours? Contribute! <sup><b><a href="https://github.com/1Password/shell-plugins/blob/main/CONTRIBUTING.md/#-contributions-beta-notice">[BETA]</a></b></sup>
53+
Is your favorite CLI not listed yet? Learn [how to build a new plugin](https://developer.1password.com/docs/cli/shell-plugins/contribute) yourself and then open a PR on this repository to get it included in the 1Password CLI!
3854

3955
For the contribution guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md).
4056

41-
Not sure where or how to get started? We're happy to help! You can:
57+
**Quick start:** clone or fork this repo and run
58+
```shell
59+
make new-plugin
60+
```
61+
62+
Still not sure where or how to begin? We're happy to help! You can:
4263
- Book a free [pairing session](https://calendly.com/d/grs-x2h-pmb/1password-shell-plugins-pairing-session) with one of our developers
4364
- Join the [Developer Slack workspace](https://join.slack.com/t/1password-devs/shared_invite/zt-1halo11ps-6o9pEv96xZ3LtX_VE0fJQA), and ask us any questions there
4465

45-
## 💚 Community & Support
66+
## 💙 Community & Support
4667

4768
- File an [issue](https://github.com/1Password/shell-plugins/issues/new/choose) for bugs and feature requests
4869
- Join the [Developer Slack workspace](https://join.slack.com/t/1password-devs/shared_invite/zt-1halo11ps-6o9pEv96xZ3LtX_VE0fJQA)
4970
- Subscribe to the [Developer Newsletter](https://1password.com/dev-subscribe/)
50-
- Join our [Community Office Hours](https://1password.zoom.us/meeting/register/tJIqdeqtqT4jHterIHSSJ63tY719lUrJCufe) on January 17 at 12:00 Noon Eastern (New York City) time for live help and support in getting started using or building a Shell Plugin
51-
52-
## 📣 Beta Notice
53-
54-
The plugin ecosystem is still in beta. In practice, this means that if you're locally building your own plugins, you'll likely have to recompile your plugin every now and then to keep up with the latest updates of the 1Password CLI.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"path/filepath"
7+
8+
"github.com/mitchellh/go-homedir"
9+
)
10+
11+
// Retrieve the config directory to read or write to
12+
func main() {
13+
// This logic is based on the order of precedence outlined in the CLI documentation:
14+
// https://developer.1password.com/docs/cli/config-directories
15+
16+
// If OP_CONFIG_DIR is set, use it immediately
17+
if opConfigDir, _ := os.LookupEnv("OP_CONFIG_DIR"); opConfigDir != "" {
18+
fmt.Print(opConfigDir)
19+
return
20+
}
21+
22+
xdgConfigHome, _ := os.LookupEnv("XDG_CONFIG_HOME")
23+
home, _ := homedir.Dir()
24+
configDirPaths := []string{}
25+
if home != "" {
26+
// Legacy home
27+
configDirPaths = append(configDirPaths, filepath.Join(home, ".op"))
28+
}
29+
if xdgConfigHome != "" {
30+
// Legacy xdg
31+
configDirPaths = append(configDirPaths, filepath.Join(xdgConfigHome, ".op"))
32+
}
33+
if home != "" {
34+
// New home
35+
configDirPaths = append(configDirPaths, filepath.Join(home, ".config", "op"))
36+
}
37+
if xdgConfigHome != "" {
38+
// New xdg
39+
configDirPaths = append(configDirPaths, filepath.Join(xdgConfigHome, "op"))
40+
}
41+
42+
for _, configDir := range configDirPaths {
43+
fileInfo, err := os.Stat(configDir)
44+
if err == nil && fileInfo.IsDir() {
45+
fmt.Print(configDir)
46+
return
47+
}
48+
}
49+
50+
// None of those directories exist and OP_CONFIG_DIR is not set
51+
// Default to the last entry in the list
52+
if len(configDirPaths) > 0 {
53+
fmt.Print(configDirPaths[len(configDirPaths)-1])
54+
}
55+
}

go.mod

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ module github.com/1Password/shell-plugins
33
go 1.18
44

55
require (
6+
github.com/99designs/aws-vault/v7 v7.0.0-rc2
7+
github.com/99designs/keyring v1.2.2
68
github.com/AlecAivazis/survey/v2 v2.3.6
79
github.com/BurntSushi/toml v1.2.1
8-
github.com/aws/aws-sdk-go-v2 v1.17.1
9-
github.com/aws/aws-sdk-go-v2/credentials v1.12.23
10-
github.com/aws/aws-sdk-go-v2/service/sts v1.17.1
10+
github.com/aws/aws-sdk-go-v2 v1.17.5
11+
github.com/aws/aws-sdk-go-v2/service/sts v1.18.5
1112
github.com/fatih/color v1.13.0
1213
github.com/hashicorp/go-plugin v1.4.6
1314
github.com/stretchr/testify v1.8.1
@@ -17,21 +18,39 @@ require (
1718
)
1819

1920
require (
20-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25 // indirect
21-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19 // indirect
22-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19 // indirect
23-
github.com/aws/smithy-go v1.13.4 // indirect
21+
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
22+
github.com/alecthomas/kingpin v0.0.0-20200323085623-b6657d9477a6 // indirect
23+
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
24+
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
25+
github.com/aws/aws-sdk-go-v2/config v1.18.15 // indirect
26+
github.com/aws/aws-sdk-go-v2/credentials v1.13.15 // indirect
27+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.23 // indirect
28+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.29 // indirect
29+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.23 // indirect
30+
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.30 // indirect
31+
github.com/aws/aws-sdk-go-v2/service/iam v1.19.4 // indirect
32+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.23 // indirect
33+
github.com/aws/aws-sdk-go-v2/service/sso v1.12.4 // indirect
34+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.4 // indirect
35+
github.com/aws/smithy-go v1.13.5 // indirect
36+
github.com/danieljoos/wincred v1.1.2 // indirect
2437
github.com/davecgh/go-spew v1.1.1 // indirect
38+
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
39+
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
2540
github.com/golang/protobuf v1.3.4 // indirect
41+
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
2642
github.com/hashicorp/go-hclog v0.14.1 // indirect
2743
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect
2844
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
2945
github.com/mattn/go-colorable v0.1.9 // indirect
30-
github.com/mattn/go-isatty v0.0.14 // indirect
46+
github.com/mattn/go-isatty v0.0.17 // indirect
3147
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
48+
github.com/mitchellh/go-homedir v1.1.0 // indirect
3249
github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77 // indirect
50+
github.com/mtibben/percent v0.2.1 // indirect
3351
github.com/oklog/run v1.0.0 // indirect
3452
github.com/pmezard/go-difflib v1.0.0 // indirect
53+
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
3554
golang.org/x/net v0.8.0 // indirect
3655
golang.org/x/sys v0.6.0 // indirect
3756
golang.org/x/term v0.6.0 // indirect

0 commit comments

Comments
 (0)