Code Monkey home page Code Monkey logo

cvcap's Introduction

Sometime programmer.

Jack of more than a few trades. Master of less than one.

cvcap's People

Contributors

crispinb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cvcap's Issues

add bookmark from clipboard

Adding a bookmark via the clipboard seems like a good compromise (don't force user to get toml right, but otoh also don't need to build a whole checkvist browser into the UI).

cvcap add-bookmark <bookmark-name> adds a bookmark from the clipboard (either a list or item URL) and names it bookmark-name

CVCap pulls any content off the clipboard, validates it, checks the existence of the bookmark, and if present on the server, writes it to the config file.

Attach a file

ie. something like cvcap add task_content -f [filename]

Consider moving to reqwest

Have avoided because I didn't need async/tokio for anything else. But I'll need it for the new sync feature, so might as well go all in

linux-musl binary faulty (build or link problem?)

Successfully builds with the github actions ubuntu runner. But the binary doesn't call any copypasta functions. I think there's a musl issue with the x11-clipboard dep (that copypasta has). Investigate.

Refactor add.rs

cf. the add-bookmark.rs pattern. Generally:

  • split functions that interact from those that don't
  • the former create data structures that the latter use
  • the type system validates

Improve scripting UI

There are really 3 types of UIs for terminal use:

  1. the classic cli, with all necessary data supplied as flags, for one-shot interactionless use
  2. interactive, prompting the user linewise for missing info (eg. npm create ...)
  3. tui

cvcap currently is an awkward blend of cli/interactive - mostly interactive but sort-of cli with the -q flag. Currently however this mode just fails when info is missing (eg there's no defualt list), with no capacity to provide the missing data as part of the invocation.

The standard approach to dealing with cli vs interactive is to blend them, using an ever more complex combination of flags - eg -y to skip prompts. But which prompts? This could be sorted out with positional -ys or some other complex combination of flags.

But I wonder if it might be simpler (and less tied to posix/unix) to just keep the two cases separate.

-q (or maybe something like --noninteractive to make it triply clear) can flick cvcap into a different mode, where all data must be provided to avoid a nonzero exit. To make this even clearer, and avoid having to mess more than I want to with clap, my current thought is for that data to be provided en bloc in a structure. Inline JSON perhaps, or perhaps search for a way that needs less "-escaping (does this even matter for scripting/programmatic use?)

Move config to config-rs or figment

Then my interaction wrapper could be a config-rs or figment provider - ie. give it a config and an ordering, and it can layer its config over whatever we already have

Improve output with colours

Add "long task with a name that @#$ might be hard to distinguish" as a new task? yes Adding task "long task with a name that @#$ might be hard to distinguish" to list "@main"......... Task added
The task itself isn't very legible amongst the other output, so distinguish with colour.

Implement top-level (list) sync in cvcap cli

Not sure if cli will ever use sync proper (which is mainly intended for future apps using cvapi lib)
But a useful slice as a POC would be:

on cvcap add task -l, read the lists from sqlite so they're instantly available.
Add a 'synclists' command to refresh the local list.
Not really a sync but just a list download-and-persist.

Investigate possible sync designs

Future uses of the library (eg. add tasks while offline) depend on having a local cache of some sort. Perhaps just operational updates. Perhaps an actual sync'd store. Investigate.

Destination aliases

cvcap alias [project] presents a picker, drilling through a list (or to start with perhaps just an item id)

Then cvcap add [item] [alias] puts the item in that destination rather than the default

Capture from stdin

ie. cat file | cvcap

error if text arg is also supplied cat file | cvcap 'spurious'

Add day notes

something like cvcap day "note content", which:

  • adds an item if it doesn't already exist at [year]/month/day (soft scheme with template?)
  • adds a link to this in one's configured main note

Should log in again rather than error when token refresh fails

[2022-08-01T01:08:43Z DEBUG ureq::unit] writing prelude: POST /auth/refresh_token.json?version=2 HTTP/1.1
    Host: checkvist.com
    User-Agent: ureq/2.5.0
    Accept: */*
    Content-Type: application/json
    accept-encoding: gzip
    Content-Length: 25
.[2022-08-01T01:08:43Z DEBUG ureq::response] Chunked body in response
[2022-08-01T01:08:43Z DEBUG ureq::unit] response 401 to POST https://checkvist.com/auth/refresh_token.json?version=2
[2022-08-01T01:08:43Z DEBUG ureq::stream] dropping stream: Stream(RustlsStream)
[2022-08-01T01:08:43Z DEBUG ureq::stream] dropping stream: Stream(RustlsStream)

Task added
[2022-08-01T01:08:43Z ERROR cvcap] Fatal error. Cause: TokenRefreshFailedError

    Error: Could not add task

    If you want to report this, fill out an issue at 
    https://github.com/crispinb/cvcap/issues.
    To gather more details that might help solve issue, 
    run the same command again with the '-v' switch,
    and copy the output into the issue.

can't seem to log in?

Hi,

I'm excited to try out this tool for quickly adding tasks to Checkvist. I'm trying to log in, but I'm getting the error "Couldn't get token from Checkvist API" Below is the verbose output from the error. Is there any way to unhide the text being entered into the OpenAPI key field so I can verify it is correct? I have 2-step authentication enabled, I wonder if this is the problem? Thanks!

[2022-07-12T13:56:36Z DEBUG ureq::stream] connecting to checkvist.com:443 at 89.149.211.214:443
[2022-07-12T13:56:36Z DEBUG rustls::client::hs] No cached session for DnsName(DnsName(DnsName("checkvist.com")))
[2022-07-12T13:56:36Z DEBUG rustls::client::hs] Not resuming any session
[2022-07-12T13:56:36Z DEBUG rustls::client::hs] ALPN protocol is None
[2022-07-12T13:56:36Z DEBUG rustls::client::hs] Using ciphersuite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
[2022-07-12T13:56:36Z DEBUG rustls::client::tls12::server_hello] Server supports tickets
[2022-07-12T13:56:37Z DEBUG rustls::client::tls12] ECDHE curve is ECParameters { curve_type: NamedCurve, named_group: X25519 }
[2022-07-12T13:56:37Z DEBUG rustls::client::tls12] Server DNS name is DnsName(DnsName(DnsName("checkvist.com")))
[2022-07-12T13:56:37Z DEBUG rustls::client::tls12] Session saved
[2022-07-12T13:56:37Z DEBUG ureq::stream] created stream: TcpStream { addr: 10.8.4.165:63194, peer: 89.149.211.214:443, socket: 444 }
[2022-07-12T13:56:37Z DEBUG ureq::unit] sending request POST https://checkvist.com/auth/login.json?version=2
[2022-07-12T13:56:37Z DEBUG ureq::unit] writing prelude: POST /auth/login.json?version=2 HTTP/1.1
Host: checkvist.com
User-Agent: ureq/2.4.0
Accept: /
Content-Type: application/json
accept-encoding: gzip
Content-Length: 53
[2022-07-12T13:56:37Z DEBUG ureq::unit] response 401 to POST https://checkvist.com/auth/login.json?version=2
[2022-07-12T13:56:37Z ERROR cvcap] Fatal error. Root cause: Status(401, Response[status: 401, status_text: Unauthorized, url: https://checkvist.com/auth/login.json?version=2])

Error: Couldn't get token from Checkvist API

If you want to report this, fill out an issue at
https://github.com/crispinb/cvcap/issues.
To gather more details that might help solve issue,
run the same command again with the '-v' switch,
and copy the output into the issue.

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.