A simple command-line tool to help organize your knowledge base.
This tool allows you to quickly copy files, directories, or piped content into a structured knowledge base directory.
It is recommended to install this tool in a virtual environment or using pipx to avoid conflicts with system packages. However, you can also install it globally for your user.
Navigate to the root of this repository (the directory containing setup.py) and run:
pip install .To install for just the current user (without needing root permissions), use:
pip install --user .After installation, the keepit command will be available in your shell.
If you have new changes (e.g., you pulled from git), you can upgrade your installation by running the same command with the --upgrade flag:
pip install --upgrade .After installing the tool, you need to initialize it to create the configuration file. Run:
keepit --initThis command will:
- Create the configuration directory and file for your operating system.
- Prompt you to enter the path to your knowledge base root directory. This is optional; you can leave it blank and edit the file later.
- On Linux, check if a required dependency for clipboard support (
xcliporxsel) is installed and notify you if it's missing.
The config.json file will be created in one of the following locations:
- Linux/macOS:
~/.config/keepit/config.json - Windows:
C:\Users\<YourUser>\AppData\Local\keepit\config.json
You can edit this file at any time to change your knowledge base path.
{
"knowledge_base_root": "/path/to/your/knowledge_base"
}The keepit command can be used in three ways:
You can pass a file or a directory path as an argument to keepit.
keepit /path/to/your/file.csvWhen you run the command, an interactive prompt will appear, allowing you to select a destination directory within your knowledge base. You can also choose to create a new directory (including nested ones).
You can pipe the output of any command directly into keepit.
cat some_log_file.log | keepitSimilar to the file/directory mode, you will be prompted to select or create a destination directory and then provide a filename for the content.
You can use the --clipboard flag to save content directly from your system clipboard.
keepit --clipboardThis will take whatever text is in your clipboard and prompt you for a destination directory and a filename.
Note for Linux users: This feature requires xclip or xsel to be installed. The keepit --init command will warn you if you don't have it.
After successfully saving a file or directory, if your knowledge_base_root is a Git repository, the tool will ask if you want to commit the changes.
Would you like to commit these changes to git? (y/N)
If you answer yes, you will be prompted to enter a commit message. The tool will then automatically git add, git commit, and git push the changes for you.
To see where your configuration file is located and what it contains, you can use the --config flag:
keepit --configThis will print the path to the config.json file and its current settings.