Skip to content

Releases: hedgedoc/cli

First stable CLI interface

24 Mar 06:28
Compare
Choose a tag to compare

Usage:

codimd <command> [args...]

$ codimd login --email
$ codimd import ~/Desktop/test.txt
$ codimd export --md somenoteidhere
$ codimd history

Commands:

import <path> [note_id]
    Import the contents of a given file as a new CodiMD note on the server.
    Takes an optional note_id, if not given it will generate a random one.
    Returns the private note ID $CODIMD_SERVER/<private_note_id>

publish <note_id>
    Publish a note as view-only html (hosted on server at /s/<note_name>).
    Returns the public note ID $CODIMD_SERVER/s/<public_note_id>

export --md|--html|--pdf|--slides <note_id> [output_path]
    Export the contents of a given note on the server to a given local path.

delete <note_id>
    Delete the given note from the server.


login --email|--ldap [username] [password]
    Authenticate the CLI with the server.
    (If not passed as args, user & password will be asked for via stdin)
    Stores session key in $CODIMD_COOKIES_FILE=~/.config/codimd/key.conf

logout
    Deauthenticate the CLI from the server and delete $CODIMD_COOKIES_FILE.

profile
    View the current authenticated user details.

history
    View the current logged in user's list of accessed notes.

Config:

Configuration is set via environment variables (e.g. in ~/.bashrc or shell).

$CODIMD_SERVER       (defaults to http://127.0.0.1:3000)
$CODIMD_CONFIG_DIR   (defaults to $XDG_CONFIG_HOME/codimd)
$CODIMD_COOKIES_FILE (defaults to $CODIMD_CONFIG_DIR/key.conf)

Usage examples:

$ export CODIMD_SERVER='$CODIMD_SERVER'
$ export CODIMD_COOKIES_FILE=$CODIMD_COOKIES_FILE

$ codimd import ~/Desktop/example_note.md
qhmNmwmxSmK1H2oJmkKBQQ
$ codimd import ~/notes/favorite_movies.txt "favorite-movies"
favorite-movies
$ open \"$CODIMD_SERVER/qhmNmwmxSmK1H2oJmkKBQQ\"

$ codimd publish qhmNmwmxSmK1H2oJmkKBQQ
S1ok9no3f
$ codimd publish favorite-movies
favorite-movies
$ open \"$CODIMD_SERVER\/s/qhmNmwmxSmK1H2oJmkKBQQ\"

$ codimd export --pdf qhmNmwmxSmK1H2oJmkKBQQ example_note.pdf
$ codimd export --slides favorite-movies favorite-movies.zip

$ codimd delete qhmNmwmxSmK1H2oJmkKBQQ
$ codimd delete favorite-movies

$ codimd login --email [email protected] p4sW0rD
$ codimd login --ldap ldap-user
$ codimd login --email
$ codimd logout
$ codimd profile
$ codimd history
$ codimd history --json

Alpha CLI interface

24 Mar 06:30
7ddb754
Compare
Choose a tag to compare

This is the old CLI before the CLI interface was stabilized.

The main differences from v1.0 are that it outputs to stdout in a different format for codimd import and codimd publish.

See issue #31 for details.