Skip to content
/ cmddocs Public

An interactive commandline interface for your personal docs using python, Cmd, git and markdown

License

Notifications You must be signed in to change notification settings

noqqe/cmddocs

Repository files navigation

https://travis-ci.org/noqqe/cmddocs.svg?branch=master

cmddocs

cmddocs is an interactive commandline wiki. It lets you easily maintain your docs/cheetsheets/notes using:

  • Plain Text Files
  • Write markdown in your local Editor
  • View in your local Pager
  • Versioning with git

cmddocs is like a framework around your plaintext files.

Why ?

I kind of started cmddocs because I couldn't find something like this on the internet. Here's my usecase. Im working as a DevOps guy being in touch with various types of software, languages, tools, operating systems and databases. To remember all those things I need a place to store commands, workflows and short howtos.

Most of the software I use (and love) runs on a OpenBSD Box on the internet and are commandline-based. These are mutt, taskwarrior, jrnl, weechat and so on...But i was missing a tool for documentation.

After switching to just plaintext files using vim and git it was also a bit annoying. So I wrote cmddocs to make it easier for me to handle my plaintext files.

Markdown Rendering

cmddocs uses the mistune lexer to wrap markdown with ansi control sequences instead of html tags.

It looks something like this.

https://raw.github.com/noqqe/cmddocs/master/cmddocs-md2ascii.png

Demo

To give you an idea what it looks/feels like I created a short terminal recording.

asciinema cmddocs demo

Installation

pip install cmddocs

Also make sure you have tree installed.

Configuration

Create .cmddocsrc file in your $HOME with the following content (adjust to your needs):

[General]
Datadir = /home/noqqe/Docs
Default_Commit_Message = small changes
Excludedir = .git/
Editor = /usr/local/bin/vim
# EditorFlags = -C
Pager = /usr/bin/less
PagerFlags = -fr
Prompt = cmddocs>
Promptcolor = 37
Intro_Message = cmddocs - press ? for help
Mail = mail@example.org
Default_Extension = md

[Colors]
Header12 = 37
Header345 = 37
Codeblock = 92

The only required option is "Datadir", everything else will be guessed or defaults to a sane default value. Once you start cmddocs.py the CLI will be shown. Use help for commands.

Quick Start

At first, create a very minimal config, like

[General]
Datadir = /home/noqqe/Docs
Editor = /usr/local/bin/vim
Pager = /usr/bin/less

Then you can start using cmddocs.

$ cmddocs
cmddocs - press ? for help
cmddocs> help

Documented commands (type help <topic>):
========================================
EOF  delete  e     help  list  mail  pwd     search  undo
cd   diff    edit  info  log   move  revert  stats   version
d    dirs    exit  l     ls    mv    rm      status  view

cmddocs> help l

    Show files in current working dir

cmddocs> help log

    Show git logs of your docs.

    Usage: log                      # default loglines: 10)
           log 20                   # show 20 loglines
           log 20 article           # show log for specific article
           log databases/mongodb 3  # same

Command Documentation

cd

Change directory

Usage:
    cd Programming/
    cd

delete, rm