Are there exit codes in op?

dnedrow
dnedrow
Community Member

It seems as though op doesn't have appropriate exit codes defined. So far as I can tell, every command returns 0 regardless of whether the command succeeded or failed.

Current behavior:

~ op signout
~ echo $?
0

~ op get item ifz5dq35drfcrf4uo5xvnxkljb | jq '.details.fields[] | select(.designation=="password").value'
[LOG] 2019/02/12 16:23:58 (ERROR) You are not currently signed in. Please run `op signin --help` for instructions
~ echo $?
0

Expected behavior:

The second command, op get item, should exit with a code from 1-255 (inclusive) to indicate a failure.

Eg., an exit code of 1 could be used to indicate that the user isn't logged in.

This could be used in a shell script to branch to some other part of the script.

1Password 7
Version 7.2.4 (70204000)
AgileBits Store


1Password Version: 7.2.4
Extension Version: Not Provided
OS Version: 10.14.3
Sync Type: Subscription

Comments

  • cohix
    cohix
    1Password Alumni

    @dnedrow Yes, we have been inconsistent with our use of error codes until this point. We are working on a refactor of the command line library that we use, so we will be improving this in releases to come.

This discussion has been closed.