Skip to content
/ keepit Public

A cross-platform CLI to build your knowledge base like a developer's notebook. Interactively save files, piped data, and snippets with Git integration.

Notifications You must be signed in to change notification settings

go2rob/keepit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

keepit

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.

Installation

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.

Upgrading

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 .

Setup

After installing the tool, you need to initialize it to create the configuration file. Run:

keepit --init

This command will:

  1. Create the configuration directory and file for your operating system.
  2. 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.
  3. On Linux, check if a required dependency for clipboard support (xclip or xsel) is installed and notify you if it's missing.

Configuration File Location

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"
}

Usage

The keepit command can be used in three ways:

1. With a File or Directory

You can pass a file or a directory path as an argument to keepit.

keepit /path/to/your/file.csv

When 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).

2. With Piped Content

You can pipe the output of any command directly into keepit.

cat some_log_file.log | keepit

Similar to the file/directory mode, you will be prompted to select or create a destination directory and then provide a filename for the content.

3. With Clipboard Content

You can use the --clipboard flag to save content directly from your system clipboard.

keepit --clipboard

This 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.

4. Git Integration

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.

5. Viewing Configuration

To see where your configuration file is located and what it contains, you can use the --config flag:

keepit --config

This will print the path to the config.json file and its current settings.

About

A cross-platform CLI to build your knowledge base like a developer's notebook. Interactively save files, piped data, and snippets with Git integration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages