A command-line tool for quickly fetching Wikipedia summaries, written in Go. Inspired by the wikit Node.js project.
I enjoy the original project, but I don’t like having to install many files just to run a Node.js application. I prefer Go because it allows everything to be statically linked and embedded, producing a single executable with no external dependencies. This project is designed to offer that same convenience and simplicity.
- Get Wikipedia summaries from the command line
- Support for multiple languages
- Interactive disambiguation menu
- Open articles in browser
- Configurable line wrapping
- Cross-platform support
- gowikit can function as a service, exposing REST APIs.
- Grep the binary and put anywhere you want.
- To run as a service, download service.zip and see the example shell/batch/ini/service files.
- Go 1.21 or later
- Task
# On macOS brew install go-task # On Linux sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin # On Windows scoop install task
# Clone the repository git clone <repository-url> cd gowikit # Build using build-local.sh (uses Taskfile-manual.yml) ./build-local.sh
This will build the binary to dist/gowikit and create dist/service.zip.
# Clone the repository git clone <repository-url> cd gowikit # Install dependencies go mod download # Build the binary go build -o gowikit main.go # Install to system (optional) go install .
# Install dependencies task deps # Build task build # Install to system task install
Syntax: $ gowikit <query> [-flags]
Quotes are not required for multi-word queries.
To change the default language, edit ~/.config/gowikit.json.
$ gowikit wikipedia $ gowikit empire state building $ gowikit linux -b $ gowikit jugo -l es --link -a
| Flag | Description |
|---|---|
--lang langCode-l langCode |
Specify language; langCode is an HTML ISO language code |
--all-a |
Print all sections of the article (the full page). Recommended to pipe into a reader e.g. less |
--line num |
Set line wrap length to num |
--link |
Print a link to the full article after the summary |
-b |
Open full Wikipedia article in default browser |
--browser browser |
Open full Wikipedia article in specific browser |
-d |
Open disambiguation CLI menu |
-D |
Open disambiguation page in browser |
--version-v |
Print installed version number |
--name-n |
Print the name of the program: gowikit |
The output will be the paragraphs of the Wikipedia article before the table of contents. Line length is neatly wrapped based on your terminal's window size, with a max of about 80 characters. For example:
$ gowikit arch linux
Arch Linux (or Arch /ˈɑːrtʃ/) is a Linux distribution for computers based on x86-64
architectures. Arch Linux is composed predominantly of free and open-source software,
and supports community involvement. The design approach of the development team
follows the KISS principle ("keep it simple, stupid") as the general guideline,
and focuses on elegance, code correctness, minimalism and simplicity, and expects
the user to be willing to make some effort to understand the system's operation.
A package manager written specifically for Arch Linux, pacman, is used to install,
remove and update software packages. Arch Linux uses a rolling release model, such
that a regular system update is all that is needed to obtain the latest Arch software;
the installation images released by the Arch team are simply up-to-date snapshots
of the main system components. Arch Linux has comprehensive documentation in the
form of a community wiki, called the ArchWiki. The wiki is widely regarded among
the Linux community and ecosystem for often having the most recent information on
a specific topic and being applicable beyond Arch Linux.
# Show all available tasks task help # Run tests task test # Format code task format # Lint code task lint # Run all checks task check # Build for multiple platforms task release # Development mode task dev
# Run with arguments go run main.go <query> # Test go test ./... # Format go fmt ./... # Lint go vet ./... # Build go build -o gowikit main.go
The configuration file is stored at ~/.config/gowikit.json:
{
"lang": "en"
}github.com/manifoldco/promptui- Interactive promptsgithub.com/schollz/progressbar/v3- Progress barsgithub.com/spf13/viper- Configuration management
This Go version maintains feature parity with the original Node.js wikit, with some improvements:
- Faster startup time
- Single binary distribution
- Better cross-platform support
- More robust error handling
This project is not open source.
For details, please refer to LICENSE.md.
Please create an issue in the repository. Thanks!