Forum Discussion

Former Member's avatar
Former Member
4 years ago

[16,17,20,37,38] Support for both versions in scripts

Hi,

Initial impression of the new version is great! The UI with grouping by category makes sense.
And I can't wait for the TouchID support. :)

Unfortunately the changed UI also breaks all existing scripts and https://direnv.net configurations.

Maybe a note to https://developer.1password.com/docs/cli/upgrade/ about supporting both versions in shell scripts?

With Bash e.g.:

```bash
OP_VERSION="$(op --version)"

if [[ "$OP_VERSION" == 1.* ]]; then
op get item ...
else
op item get ...
fi
```

Or this should be Posix compliant:

```sh
OP_VERSION="$(op --version)"

case "$OP_VERSION" in
1.*) op get item ...;;
*) op read op://...;;
esac
```

Cheers,
- Teemu


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: macOS 12.1

12 Replies