Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Google Keep frontend for terminals.

This is alpha quality code! Don't use in production. The project is under active development, so feel free to open an issue if you have questions, see any bugs or have a feature request. PRs are welcome too!

This project is a client based on [gkeepapi](https://github.com/kiwiz/gkeepapi).

Screen cast (WIP)
-----------------

Expand All @@ -19,6 +21,19 @@ Running
$ ./keep
```

Features
--------

The CLI allows:

- [x] Adding a note (basic)
- [x] Searching a note (basic)
- [x] Modifying an existent note (basic)

The TUI allows:

**TBC**

Todo
----

Expand Down
31 changes: 22 additions & 9 deletions keep
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ set_parser.add_argument('--title', type=str, help='Set title of a note')
set_parser.add_argument('--text', type=str, help='Set body of a note')
set_parser.set_defaults(func=commands.set)

add_parser = subparsers.add_parser('add', help='Add a new note')
add_parser.add_argument('--title', type=str, help='The title of the note')
add_parser.add_argument('--text', type=str, help='The body of the note')
add_parser.set_defaults(func=commands.add)

args = parser.parse_args()

if not os.path.isdir(args.config_dir):
Expand Down Expand Up @@ -124,12 +129,20 @@ if not logged_in:
token = keep.getMasterToken()
keyring.set_password('google-keep-token', config['username'], token)
logger.info('Success')
except gkeepapi.exception.LoginException:
logger.info('Login failed')

if not logged_in:
logger.error('Failed to authenticate')
sys.exit(1)


args.func(args, keep, config)
except gkeepapi.exception.LoginException as err:
logger.error('Login failed')
logger.error('Ensure you have:')
logger.error('- entered correctly your password for the account: ' + config['username'])
logger.error('- allowed less secured apps at: https://myaccount.google.com/lesssecureapps?pli=0 (*)')
logger.error('- unlocked the account via captcha: https://accounts.google.com/b/0/DisplayUnlockCaptcha (*)')
logger.error('')
logger.error('(*) where 0 is your Google account id, may be different if multiple logins, adapt it')
raise err



try:
func = args.func
except AttributeError:
parser.error("Invalid arguments!")
func(args, keep, config)
4 changes: 4 additions & 0 deletions keep_cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,7 @@ def set(args: argparse.Namespace, keep: gkeepapi.Keep, config: dict):
note.text = args.text

_sync(args, keep, config, True)

def add(args: argparse.Namespace, keep: gkeepapi.Keep, config: dict):
keep.createNote(args.title, args.text)
_sync(args, keep, config, True)