Code Monkey home page Code Monkey logo

cub-cli's Introduction

Build Status license: MIT

CUB

CUB stands for Command-line Utility for Bear and offers a simple CLI interface to the notes, tags, and media stored within your bear writer application.

TODO

  • List notes.
    • Configure rendering options
      • limit
      • w/ text.
      • w/ creation/modification date.
    • Filter by note status.
    • Filter by tag.
  • View a single note.
  • View fun stats for all notes/note?

Installing

brew tap a5huynh/brew
brew install a5huynh/brew/cub-cli

How to do things

Here is how to do some common things with the cub CLI. Also check out cub --help to see all command/options you can use.

Listing out notes.

# List _all_ notes.
> cub ls

# Limit output to 10 notes
> cub ls --limit 10
> cub ls -l 10

# List notes w/ full-text
# BEWARE: If you have a lot of very large notes this _will_ output the
# entirety of the text to the terminal.
> cub ls --text
> cub ls -t

View a note.

# Notes are prefixed with their ID in the `ls` command. Use that ID
# here to output the full text.
> cub show 571

Building from scratch

CUB is build using the latest stable version of rust-lang and can be built from scratch using the following command:

cargo build --release

cub-cli's People

Contributors

a5huynh avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cub-cli's Issues

Cannot list notes

Hey there, thanks for providing this CLI! I, unfortunately, was unable to list notes and got the following error:

> RUST_BACKTRACE=1 cub ls
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidColumnType(2, Null)', libcore/result.rs:1009:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: rusqlite::row::Row::get
  10: libcub::note::Note::from_sql
  11: <rusqlite::row::MappedRows<'conn, F> as core::iter::iterator::Iterator>::next
  12: <rusqlite::row::MappedRows<'conn, F> as core::iter::iterator::Iterator>::next
  13: libcub::list_notes
  14: cub::main
  15: std::rt::lang_start::{{closure}}
  16: std::panicking::try::do_call
  17: __rust_maybe_catch_panic
  18: std::rt::lang_start_internal
  19: main

viewing individual notes with cub show ### does work as expected for me

Can't list notes by tags

Hey @a5huynh - great project!

Unfortunately, I'm not able to list notes by tag due to the tags-to-notes join table having a different name than expected. See this ticket for a detailed explanation, along with probable fix: calebporzio/bear-sync#4

Here's what I did:

% RUST_BACKTRACE=1 cub ls -t writing/drafting
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some("no such table: Z_6TAGS"))', src/libcub/mod.rs:132:28
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: std::panicking::rust_panic_with_hook
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::option::expect_none_failed
   9: libcub::list_notes
  10: cub::main
  11: std::rt::lang_start::{{closure}}
  12: std::panicking::try::do_call
  13: __rust_maybe_catch_panic
  14: std::rt::lang_start_internal
  15: main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

You can see my join table is actually called Z_7TAGS rather than Z_6TAGS:
image

I'm running BearApp 1.7.16

Update CLI to work w/ Mojave

Currently receiving this error when running the CLI:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SqliteFailure(Error { code: CannotOpen, extended_code: 14 }, Some("unable to open database file"))', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Help text is missing options

The help text output by cub -h or cub --help is missing many of the options like filtering and limiting the number of returned items.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.