31

cx: A directory history utility written in C

 3 years ago
source link: https://github.com/colfrog/cx
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

cx

A directory history utility written in C

Using cx

cxd -d
/usr/local/share/cx/

Installing

This program requires the SQLite3 development headers and library.

make && sudo make install should build and install the program to /usr/local by default. Defining the PREFIX environment variable will let you define where it's installed. Scripts for various shells are installed in ${PREFIX}/share/cx , which you should include for your respective shell to have convenient access to the cx command.

How it works

cxd

cxd is a daemon that runs in the background and receives messages from a UNIX socket at ~/.cx/socket by default. A simple text-based protocol is defined to send and receive messages.

flags

  • -d: daemonize
  • -D : define the database path
  • -s : define the socket path

cxc

cxc is the client, it basically figures out what you want to do from your arguments, and sends the message to cxd. It's used as a backend for the cx command, but it can also be used to manually change a directory's priority, lock or unlock priorities in place, remove entries and push new entries. You can also use it to dump the entire database's contents.

flags

  • Any string after the arguments (or after --) is jumped to if a match is found
  • -p : add an entry representing this path, if it exists
  • -s : specify the path of the socket to use to communicate with cxd
  • -d: Dump the database's contents
  • -i : specify the ID of the entry to modify using other flags (all flags below require this argument)
  • -S: set priority for the entry
  • -l: lock the entry
  • -u: unlock the entry
  • -t: toggle the lock on the entry
  • -r: remove the entry

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK