Git Product home page Git Product logo

dn's Introduction

dn - Daily notes command line tool

This tool is a Go implementation of tomlockwood's dn tool.

dn is a simple command line tool to keep notes.

Usage

dn writes a bullet-pointed string to a file with today's date in YYYY-MM-DD format. The notes are stored in the ~/dn/ folder if $DN_HOME is not set. Otherwise, the notes are stored in the folder specified by $DN_HOME. $DN_HOME must be a valid and absolute file path.

dn o does the same, but the first argument is the filename. This can be used for future notes i.e. dn o 2030-10-01 "I died".

dn t displays today's notes.

dn v displays all files, or when an argument like 2022-12 is passed, ~/dn/2022-12*.

dn s searches for the first argument in all notes. If the argument contains at least one capital letter, the search is case-sensitive. Otherwise, it is case-insensitive.

dn et edit today's notes in $EDITOR. If the environment variable $EDITOR is not defined or empty, vim is used.

dn e opens the note in $EDITOR for a given date, i.e. dn e 2022-12-12. If no date is passed then the editor's file selection prompt is shown.

Example

$ dn "Polished this project"

$ dn v
2022-11-30
 * Started working on the port of dn
 * Successfully ported dn
2022-12-11
 * Finished other sideproject
2022-12-12
 * Polished this project

$ dn s po
2022-11-30:1: * Started working on the port of dn
2022-11-30:2: * Successfully ported dn
2022-12-12:1: * Polished this project

$ dn s Po
2022-12-12:1: * Polished this project

$ dn v 2022-11
2022-11-30
 * Started working on the port of dn
 * Successfully ported dn

$ dn t
2022-12-12
 * Polished this project

$ dn o 1970-01-01 "Time starts"

$ dn v
1970-01-01
 * Time starts
2022-11-30
 * Started working on the port of dn
 * Successfully ported dn
2022-12-11
 * Finished other sideproject
2022-12-12
 * Polished this project

$ dn v 2022
2022-11-30
 * Started working on the port of dn
 * Successfully ported dn
2022-12-11
 * Finished other sideproject
2022-12-12
 * Polished this project

Setup

Run go install github.com/GLAD-DEV/dn@latest

dn's People

Contributors

glad-dev avatar

Stargazers

Valentin avatar  avatar

Watchers

 avatar

dn's Issues

Idea: Instead of explicit "case sensitive search", use "smart case" search from `fd`

I like how fd approaches case sensitive search. They refer to their approach as "smart case" and it works as follows:

  • Searching by default is case insensitive
  • If the search term contains at least one capital letter, search is case sensitive

This covers most use cases of case sensitive search and makes the CLI simpler, as S could be removed.

Suggestion: Flag "--version"

I just filed a bug but had to refer to "the current version". A flag "--version / -V" could be useful for this.

Discussion: Mode argument instead of flags

Flags suggest that multiple can be combined โ€“ which they can't.
Would it be reasonable to instead use a single "mode argument", e.g.:

$ dn t
2022-12-19
 * example
$ dn e

Of course, that would either require to add a mode argument for adding notes (which may be suboptimal), or to have two binaries with different names for adding notes vs. editing / viewing etc. Curious to hear your thoughts!

Regression: Short command not listed in help any more

The help used to list the short commands as well as the long ones, e.g.:

  add (a)		Adds note with today's date. Can be omitted if note is longer than three chars.

Now, it only lists the long ones:

  add         Adds note with today's date. Can be omitted if note is longer than three chars.

To get the short one, we have to run dn <cmd> -h, which is one additional step:

$ dn add -h
Adds note with today's date. Can be omitted if note is longer than three chars.

Usage:
  dn add [note] [flags]

Aliases:
  add, a

Examples:
dn add "This note will be added with today's date"

Flags:
  -h, --help   help for add

Suggestion: "verbose" flag or disabling verbose output

This issue is something that really depends on your preference โ€“ feel free to discard.

Adding a note currently leads to two lines of output being printed. The note is echoed and a short blurb notes how the operation could be undone.

After the first time, this output is not useful anymore. I would therefore suggest a flag -v that activates verbosity. In that mode, the output is printed. Otherwise, not output is printed.

Alternatively, in my view, this output could also just be removed.

Feature suggestion: configurable base directory

It's relatively easy to configure dn's base directory, as it reads DN_HOME (and the script can of course just be adapted).

Maybe it makes sense to either read DN_HOME as well or to allow configuring the base directory (potentially before building)?

Suggestion: Allow custom editor

I prefer to use other editors than vim, so it would be nice to be able to configure that.

Suggestion: Read $EDITOR environment variable (seems preferable).

Alternative: Allow custom configuration with (1) own environment variable (e.g., $DN_EDITOR) or config file (may be overblown, though).

Bug: completion sub-command

I'm on version 1.6.0.

In the --help, a command completion is listed. Yet, it seems to be not recognized:

$ dn -h
Usage:
  dn [command]

Available Commands:
  add         Adds note with today's date. Can be omitted if note is longer than three chars.
  completion  Generate the autocompletion script for the specified shell
  config      Interact with dn's config.
# ...
$ dn completion
Added 'completion' to today's note
If this was not intended, run `dn et` to edit today's note

So either (1) the command is wrongly listed or (2) the argument parsing does not detect it correctly.

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.