Skip to content
A more feature full command line history logger/viewer. It logs the command, path and timestamp.
Haskell Nix Shell
Branch: master
Clone or download
Latest commit c9d42f7 Nov 17, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
nix nixify Nov 4, 2019
src Add limit functionality, path equals and command equals filter. Nov 17, 2019
.ghci Initial Nov 3, 2019
.gitignore inital Aug 23, 2018
ChangeLog.md inital Aug 23, 2018
LICENSE inital Aug 23, 2018
MoscoviumOrange.cabal cabal file Nov 16, 2019
README.md Update README.md Nov 18, 2019
Setup.hs inital Aug 23, 2018
default.nix Nixify with my own rainbox for performance fix thingy. Stackify too. Nov 17, 2019
default.profiling.nix Profiling with nix Nov 16, 2019
demo.jpg readme Nov 10, 2019
ghcid.sh nixify Nov 4, 2019
package.yaml Profiling with nix Nov 16, 2019
shell.nix nixify Nov 17, 2019
stack.yaml Nixify with my own rainbox for performance fix thingy. Stackify too. Nov 17, 2019

README.md

MoscoviumOrange

Screenshot

A more feature full command line history logger/viewer. It logs the command, path and timestamp.

Some examples:

  • To view the history of all commands in the current directory or it's children:

    moscoviumorange --path-prefix=$PWD
    
  • To view the history of all commands that had curl anywhere.

    moscoviumorange --command-contains=curl
    

There are options to filter the results by:

  • path prefix/suffix/anywhere
  • command prefix/suffix/anywhere
  • before / after (time)

I've tried to make it efficient by only writing to the filesystem if there are new entries, as well as only writing every n seconds.

Installation

Nix

nix-env -i -f https://github.com/chrissound/MoscoviumOrange/archive/master.tar.gz

Others

Probably install cabal / stack and then build it from there.

Help

moscoviumorange --help  
General program title/description

Usage: moscoviumorange ([--print] [--limit NUMBER] | [--print-filter]
                       [--path-contains STRING] [--path-prefix STRING]
                       [--path-suffix STRING] [--path STRING]
                       [--command-contains STRING] [--command-prefix STRING]
                       [--command-suffix STRING] [--command STRING]
                       [--before STRING] [--after STRING] [--limit NUMBER] |
                       [--daemon])

Available options:
  -h,--help                Show this help text
  --print                  Whether to be quiet
  --limit NUMBER           limit
  --print-filter           Print with filter
  --path-contains STRING   command
  --path-prefix STRING     command
  --path-suffix STRING     command
  --path STRING            path equals
  --command-contains STRING
                           command
  --command-prefix STRING  command
  --command-suffix STRING  command
  --command STRING         command equals
  --before STRING          command
  --after STRING           command
  --limit NUMBER           limit
  --daemon                 Run daemon listener

Daemon

Just run moscoviumorange --daemon.

With Nixos:

let

  moscoviumorange = pkgs.callPackage ??????????????? {};
  in
...
  systemd.user.services = {
    moscoviumOrange = {
      enable = true;
      description = "MoscoviumOrange terminal history";
      serviceConfig = {
        Type      = "simple";
        ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p %h/.config/moscoviumOrange/pending/";
        ExecStart = "${moscoviumorange}/bin/moscoviumorange --daemon";
        Restart   = "always";
        RestartSec   = 1;
      };
      wantedBy = [ "default.target" ];
    };
  };

Configure with ZSH

Requires: jq + BSD netcat

function printc () {
  # (nohup ~/ScriptsVcs/addEntryToMoscoviumOrange.sh "$1" &) > /dev/null 2>&1 # 
  if [ -S ~/.config/moscoviumOrange/monitor.soc ]; then
      $(jq -n --arg command "$1" --arg path "$PWD" '{"command":$command, "path":$path}' | "$(echo 'readlink -f $(which nc)' | nix run nixpkgs.netcat)" -N -U ~/.config/moscoviumOrange/monitor.soc &)
  else
      echo "Failed to log command to moscoviumorange" > /dev/stderr
  fi
}

add-zsh-hook preexec printc
You can’t perform that action at this time.