diff --git a/README.md b/README.md
index 95c8dea..db1c040 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,9 @@ or if terminal apps are your preference.
The **dirnotes-cli** is a command line tool,
which may be handy for scripting. This all can also do maintenance on the database.
+
+
+
## USAGE
The **dirnotes** program displays usage and keystoke info
@@ -49,7 +52,7 @@ The **dirnotes-cli** program has a man page.
In short, you navigate **dirnotes** and
**dirnotes-tui** by using the up/down arrow keys,
- to enter into a directory.
+\ to enter into a directory.
The **-tui** version accepts _e_ for edit, _s_ for sort, _M_ to change
between xattr/database priority.
@@ -68,10 +71,22 @@ The **dirnotes** app requires _Python3_ and the _Qt5_ framework.
The **dirnotes-tui** and **dirnotes-cli** apps
simply require _Python3_.
-Simply copy the file into your path, to ~/.local/bin for example.
+Simply mark the 3 python files as executable copy them into your
+path, to \~/.local/bin/ or /usr/local/bin/.
+
+ chmod a+x dirnotes dirnotes-tui dirnotes-cli
+ cp dirnotes dirnotes-tui dirnotes-cli \~/.local/bin/
+
For a better GUI experience, copy
-dirnotes.desktop to ~/.local/share/applications and
-dirnotes.xpm to ~/.local/share/icons/
+dirnotes.desktop to \~/.local/share/applications and
+dirnotes.xpm to \~/.local/share/icons/
+
+If you are using the command-line tool **dirnotes-cli**,
+you can generate a man page using
+
+ pandoc -s -t man -o dirnotes-cli.1 dirnotes-cli.md
+
+and copy that to ```~/.local/share/man/man1```
### CONFIG FILE
@@ -79,9 +94,9 @@ By default, the file **~/.config/dirnotes/dirnotes.conf** will be used to
load the user's config.
This is a JSON file, with three attributes that are important:
-> * xattr_tag (default: usrr.xdg.comment)
-> * database (default: ~/.local/share/dirnotes/dirnotes.db, sensible alt: /var/lib/dirnotes.db)
-> * start_mode (_xattr_ or _db_ display priority)
+* xattr_tag (default: user.xdg.comment)
+* database (default: ~/.local/share/dirnotes/dirnotes.db, sensible alt: /var/lib/dirnotes.db)
+* start_mode (_xattr_ or _db_ display priority)
The _config_file_ should be auto-generated the first time one of
the **dirnotes** apps is run.
@@ -190,9 +205,7 @@ As comments are editted or appended, new records are added to the database.
Older records are are not purged. This gives you a history of the comments,
but it means that fetching the most recent comment involves something like
-~~~~
- SELECT * FROM dirnotes WHERE name=? ORDER BY comment_date DESC
-~~~~
+ SELECT * FROM dirnotes WHERE name=? ORDER BY comment_date DESC
and just fetch the first record.
@@ -202,7 +215,12 @@ The database is created the first time one of the **dirnotes** apps is run.
The **dirnotes** gui app has a desktop icon built into the code.
There is not need for an external .icon file, but there is an .xpm file included
-in the project, which can be copied to ~/.local/share/icons/
+in the project, which can be copied to ~/.local/share/icons/
+
+The 3 apps share a big block of common code. At this point, the code is embedded
+in each executable, but perhaps in the future it will be brought out as a library.
+I just like apps to be a single file I can copy to my various devices and servers,
+but it does create a problem of keepint the 3 apps in sync.
### comment date & author
@@ -262,10 +280,10 @@ Does anyone have an opinion?
2. Is it ok to put the config file and database file buried in ~/.config and ~/.local?
-These directories exist on computers with a gui/windowing system installed,
-but don't neccessarily exist on headless servers.
-Perhaps the default locations should be in the user directory?
-(~/.dirnotes.conf and ~/.dirnotes.db)
+ These directories exist on computers with a gui/windowing system installed,
+ but don't neccessarily exist on headless servers.
+ Perhaps the default locations should be in the user directory?
+ (~/.dirnotes.conf and ~/.dirnotes.db)
3. Who needs translations?
@@ -284,3 +302,4 @@ Perhaps the default locations should be in the user directory?
- so, for example, the user can't add comments to /usr/bin/\*
6. Is anyone interested in the MacOS version?
+
diff --git a/dirnotes b/dirnotes
index 47dffd2..5cbd8e6 100755
--- a/dirnotes
+++ b/dirnotes
@@ -2,6 +2,7 @@
# TODO: XDG compatibility: config in ~/.config/dirnotes/dirnotes.conf and data in ~/.local/share/dirnotes/dirnotes.db
# TODO: clearing a comment out to '' doesn't seem to work on both sides
+# TODO: change banner line to indicate the CWD
""" a simple gui or command line app
to view and create/edit file comments
@@ -61,11 +62,10 @@ the comment box gets a light yellow background.
double-click the mouse, or hit <Enter>.
"""
-import sys,os,time,argparse,stat,getpass,shutil,logging,math
+import sys,argparse,logging
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt, pyqtSignal
-import sqlite3, json
xattr_comment = "user.xdg.comment"
xattr_author = "user.xdg.comment.author"
@@ -87,7 +87,7 @@ def print_d(*a):
# >>> snip here <<<
#============ the DnDataBase, UiHelper and FileObj code is shared with other dirnotes programs
-import getpass, time, stat, shutil
+import getpass, time, stat, shutil, sqlite3, json, os, math
DEFAULT_CONFIG_FILE = "~/.config/dirnotes/dirnotes.conf" # or /etc/dirnotes.conf
diff --git a/dirnotes-cli b/dirnotes-cli
index 203953b..f0a45a3 100755
--- a/dirnotes-cli
+++ b/dirnotes-cli
@@ -3,7 +3,7 @@
VERSION = "0.4"
-import os, sys, argparse, json, sqlite3
+import sys, argparse
# global mutables
answer_json = []
@@ -23,8 +23,7 @@ def errorBox(*a):
# >>> snip here <<<
#============ the DnDataBase, UiHelper and FileObj code is shared with other dirnotes programs
-import getpass, time, stat, shutil
-
+import getpass, time, stat, shutil, sqlite3, json, os, math
DEFAULT_CONFIG_FILE = "~/.config/dirnotes/dirnotes.conf" # or /etc/dirnotes.conf
# config
diff --git a/dirnotes-cli.md b/dirnotes-cli.md
index 01a449f..5cf3e6a 100644
--- a/dirnotes-cli.md
+++ b/dirnotes-cli.md
@@ -184,6 +184,9 @@ Or, in json format:
> $ dirnotes-cli -j car_notes.txt
> [{"file": "car_notes.txt", "comment": "notes on the car repair"}]
+[NOTE: with json output, consider piping the results to jq for
+pretty-print]
+
To append to a comment:
> $ dirnotes-cli -a 'first quote: \$1,400' car_notes.txt
diff --git a/dirnotes-tui b/dirnotes-tui
index 7f30de2..3cde1d2 100755
--- a/dirnotes-tui
+++ b/dirnotes-tui
@@ -17,12 +17,9 @@
# FileObj: a file with its xattr-comment and db-comment data
# Files: a collection of FileObjs, sortable
-import os, time, stat, sys, shutil
-
-import time, math
-import curses, sqlite3, curses.textpad
-import logging, getpass, argparse
-import json
+import sys, time
+import curses, curses.textpad
+import logging, argparse
VERSION = "1.9"
# these may be different on MacOS
@@ -326,8 +323,7 @@ def errorBox(string):
# >>> snip here <<<
#============ the DnDataBase, UiHelper and FileObj code is shared with other dirnotes programs
-import getpass, time, stat, shutil
-
+import getpass, time, stat, shutil, sqlite3, json, os, math
DEFAULT_CONFIG_FILE = "~/.config/dirnotes/dirnotes.conf" # or /etc/dirnotes.conf
# config