onenote

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2022 License: MIT Imports: 15 Imported by: 0

README

Onenote-CLI

A compact CLI tool to create/view the notes on your Onenote notebooks.

Build Status Build Status

preview

What is it?

You can quickly take notes on your terminal and save them as Onenote pages. It's also possible to take a note on your favorite text editor, onenote cli tool will save the note to the specified section upon quitting the editor.

Please note that this is an unofficial onenote client and in order to use this app you need to authorize this app to access and write your OneNote notes. See the Authentication section for more info.

Features

  • Take inline notes
  • Take notes on your favorite editor
  • Import contents of a file as a Onenote Page
  • Use aliases to quick access to your sections
  • Browse in your notes
  • Search in notebooks

Installation

This tool is written in Go. Run the command below to install the Onenote CLI.

$ go install github.com/fatihdumanli/onenote@latest

Authentication

Authentication is done during your very first interaction with nnote. To use this application, you must authorize nnote to access/write your Onenote notebooks and sections.

Feel free to change the ClientId and TenantId variables with yours here. You can grab yours on Azure portal. See the following link for further information.

https://docs.microsoft.com/en-us/graph/auth-v2-user?context=graph%2Fapi%2F1.0&view=graph-rest-1.0#1-register-your-app

Usage


Usage:
  nnote [command]

Available Commands:
  alias       add/list and remove alias
  browse      browse the pages within a onenote section
  help        Help about any command
  new         create a new note
  search      do a search in your notes

Creating a New Note

Use new command to take notes on your Onenote account. You can use the following flags when taking notes.

Usage
Usage:
  nnote new [flags]

Aliases:
  new, add, save

Flags:
- `-a`: Alias for the section
- `-t`: Title for the page (default is empty)
- `-i`: Use this flag to save inline note. Wrap your text with double quotes right after the flag literal.
- `-f`: Read contents of the file and save it as a Onenote page.
Take an inline note

To take an inline note, use the command new with flag -i

Example 1 - Taking an inline note

$ nnote new -i "taking inline notes is fun" 

Example 2 - Taking an inline note using an alias

$ nnote new -i "aliases help you to save time" -a foo

Example 3 - Taking an inline note with a title

$ nnote new -i "titles makes it easy to locate your notes!" -t "this is crazy important note!"

take an inline note


Take notes using your favorite editor

To take a note using your favorite editor, do not send any flags or argument along with the new command. To launch your default text editor to save a Onenote page run the following command.

$ nnote new

Upon quitting the editor, you'll be prompted to choose the notebook and section to which the note'll be uploaded.

browse in notes


Import the contents of a file as a OneNote page

Use -f flag to save the contents of a raw file as a Onenote page.

$ nnote new -f /path/to/the/file.txt -t "title-of-the-page" -a quicknotes

NOTE: You'll be prompted to choose notebook and section if you don't specify -a flag.

View your notes

Use browse command to browse in your notes. You'll be prompted to select a notebook, section and page. The page content will be rendered on terminal. You can also view your note content in web browser or Onenote desktop client.

You can navigate between your OneNote section/pages while displaying note content. You don't need to run browse command each time you want to go through your notes.

$ nnote browse

browse in notes

Search in your notes

Use search command to search in your notes. This command will perform a search in your all notesbooks and will prompt you to select one of the results to view the selected note. You can also view your notes in web browser, or Onenote desktop client.

Example

$ nnote search "redis"

search in notes

Aliases

It's encourged you to tag your sections with aliases. It'll facilitate the process of taking a new note as you'll be skipping time consuming HTTP requests to fetch your notebooks and sections.

Usage
Usage:
  nnote alias [command]

Available Commands:
  list        display alias list
  new         create a new alias.
  remove      remove an alias
Creating a new alias

Use the following command to create a new alias.

$ nnote alias new [alias]

You'll be prompted to select notebook and section in order.

Example

$ nnote alias new "quick notes"
$ nnote alias new "elasticsearch"
Listing aliases

Use list command to list your aliases and the corresponding sections.

$ nnote alias list


Alias         | Section                | Notebook
git           | Git                    | Fatih's Notebook
kafka         | Kafka                  | Fatih's Notebook
microservices | Building Microservices | Fatih's Notebook
postgresql    | PostgreSQL             | Fatih's Notebook
qn            | Quick Notes            | Fatih's Notebook
sql           | SQL Cookbook           | Fatih's Notebook
vocab         | Inner Vocabulary       | Fatih's Notebook
Removing an alias

You may want to change the mapping for an alias. Use remove command to remove an alias.

$ nnote alias remove <alias>

Example

$ nnote alias remove "qn"

Thanks

Contribution

All PRs are welcome! If you think you've discovered a bug, please open an issue first.

Licence

Released under the terms of the MIT Licence.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAlias

func GetAlias(n string) (*msftgraph.Alias, error)

Get the details of given alias Returns nil if the alias does not found

func GetAliases

func GetAliases() (*[]msftgraph.Alias, error)

func GetNotebooks

func GetNotebooks() ([]msftgraph.Notebook, error)

Get the list of notebooks belonging to the user logged in

func GetPageContent

func GetPageContent(notepage msftgraph.NotePage) ([]byte, error)

func GetPages

func GetPages(section msftgraph.Section) ([]msftgraph.NotePage, error)

Get the lisft of pages of given section

func GetSection

func GetSection(id string) (msftgraph.Section, error)

Gets the section by id

func GetSections

func GetSections(n msftgraph.Notebook) ([]msftgraph.Section, error)

Get the list of notebooks belonging to the user logged in

func RemoveAlias

func RemoveAlias(a string) error

Removes an alias

func SaveAlias

func SaveAlias(name string, notebook msftgraph.Notebook, section msftgraph.Section) error

Save the alias for a onenote section to use it later for quick save

func SaveNotePage

func SaveNotePage(npage msftgraph.NotePage, remindAlias bool) (string, error)

Save a note page using Onenote API Returns the link to the page.

func Search(phrase string) ([]msftgraph.NotePage, error)

Perfrom search in all your notebooks

Types

This section is empty.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL