• Stars
    star
    287
  • Rank 144,232 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created about 9 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Command line tool to fetch summaries from MediaWiki wikis, like Wikipedia

Build Status Godoc license Go Report Card

wiki

Command line tool to get Wikipedia summaries.

The tool can fetch summaries from any MediaWiki wiki with the API active, but defaults to the English Wikipedia.

Installation

To be able to install with go get requires you to have your $GOPATH setup and your $GOPATH/bin added to path as described here http://golang.org/doc/code.html#GOPATH.

If you don't want the man file you can just install it with go get.

$ go get github.com/walle/wiki/cmd/wiki

If you want to install the man file you can install with go get, but then use the make install command from the source directory.

$ go get github.com/walle/wiki
$ cd $GOPATH/src/github.com/walle/wiki
$ make install

or just copy the man file in _doc/wiki.1 to /usr/local/share/man/man1 or where you keep your man files.

Usage

To get a summary from Wikipedia in English just invoke the tool with a query.

$ wiki golang
Redirected from Golang to Go (programming language)

Go, also commonly referred to as golang, is a programming language developed at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. It is a statically typed language with syntax loosely derived from that of C, adding garbage collection, type safety, some structural typing capabilities, additional built-in types such as variable-length arrays & key-value maps, and a large standard library.
The language was announced in November 2009 and is now used in some of Google's production systems. Go's "gc" compiler targets the Linux, OS X, FreeBSD, NetBSD, OpenBSD, Plan 9, DragonFly BSD, Solaris, and Windows operating systems and the i386, Amd64, ARM and IBM POWER processor architectures. A second compiler, gccgo, is a GCC frontend.
Android support was added in version 1.4, which has since been ported to also run on iOS.

Read more: https://en.wikipedia.org/wiki/Go_(programming_language)

To get a localized result, e.g. in Swedish use the -l flag.

$ wiki -l sv ruby

or using System Environment:

$ WIKI_LANG="sv" wiki ruby

Use the -h flag to see all options (or man wiki if you have it installed)

$wiki -h
wiki is a tool used to fetch exerpts from wikipedia
Usage: wiki [options...] query
Options:

  -h    Print help information and exit.
  -l string
        The language to use (default "en")
  -n    If the output should not be colorized
  -no-check-certificate
        Skip verification of certificates
  -s    If simple output should be used
  -short
        If short output should be used
  -u string
        The api url (default "https://%s.wikipedia.org/w/api.php")
  -version
        Print version information and exit.
  -w int
        The width text should be wrapped at. 0 is no wrap.

Use another wiki

To get excerpts from another wiki use the -u flag to give another url to the API to use.

$ wiki -u https://en.wikiversity.org/w/api.php physics

This gives the excerpt from the wiki at wikiversity.org instead of Wikipedia.

Advice

If you frequently use the tool to fetch data from a custom url, add an alias. E.g. for bash. Add an alias to your .bash_profile or .bashrc file.

alias uwiki='wiki -u https://en.wikiversity.org/w/api.php '

And call it using

$ uwiki physics

or using System Environment in your .bash_profile or .bashrcfile.

echo "export WIKI_URL=https://en.wikiversity.org/w/api.php" >> .bashrc
# reload shell / source .bashrc
wiki physics

Testing

Run the tests using the make target test make test, this runs both the unit and the integration tests. For running only one type of tests use go test -cover and ./integration-tests.sh respectively.

$ make test

Contributing

All contributions are welcome! See CONTRIBUTING for more info.

License

The code is under the MIT license. See LICENSE for more information.

More Repositories

1

gimli

Utility for converting markup files to pdf files
Ruby
538
star
2

gas

Manage your git author accounts
Ruby
104
star
3

raycaster

A quick port of "A first-person engine in 265 lines" from JavaScript to Java using the libGDX framework.
Java
71
star
4

lll

Line length linter
Go
65
star
5

targz

Library for packaging/extracting folders in tar.gz archives.
Go
11
star
6

cfg

Simple read/write and commentable config files for go
Go
11
star
7

markdowneditor

Simple notepad like webapp/bookmarklet in three flavors. Used to scribble down notes in markdown and preview them.
11
star
8

textile2pdf

Simple utillity to convert textile to pdf files.
Ruby
7
star
9

postnummer

Ruby
7
star
10

git-cdd

Commit Driven Development in git
Shell
5
star
11

postnummer_api

Simple JSON API that gets data from https://github.com/walle/postnummer
Ruby
5
star
12

mdpdf

A small utility for converting markdown to PDF.
C
4
star
13

pgm

Dead simple tool for running migrations for postgresql
Go
4
star
14

guard-gimli

Guard gem for gimli
Ruby
4
star
15

one-word-story-game

Game where the github community creates a story one word at a time.
3
star
16

fval

Simple go library for validating file and directory existence
Go
3
star
17

cStack

A simple generic stack implementation in c
C
3
star
18

fabric-ui

Simple jquery plugin with ui for fabric.
JavaScript
3
star
19

mouseTracker

Mouse tracking image generator.
Java
2
star
20

gas_stats

Keep track of your gas usage
Ruby
2
star
21

jsular

Port of rubular.com for javascript
Ruby
2
star
22

pi2ascii

Quick test for converting the decimals of PI to ascii.
Ruby
2
star
23

dotfilesOld

My commonly used dotfiles
Shell
2
star
24

combine

Library and binary for concatenating files using a template that includes other files
Go
2
star
25

gimli-examples

A collection of example pages built with gimli
2
star
26

gypcms

A php cms that uses git, yaml and php as main components
PHP
2
star
27

lights-out

Simple game built with electron
JavaScript
1
star
28

md5calc

Old project in c# originally for windows, but compiles in monodevelop too, to calculate md5 hashes. Have functionality to save a list of words+hashes.
C#
1
star
29

todos

Ruby
1
star
30

postnummer_info

Information page for postnummer.info
JavaScript
1
star
31

dotvim

Vim setup
Vim Script
1
star
32

exoudus

Simple space shooter game
C++
1
star
33

tyda-api

App for getting JSON data from tyda.se. Outputs JSON on stdout as default.
Go
1
star
34

dotfiles

Vim Script
1
star
35

pc

Simple password generator
Ruby
1
star
36

pvm

Shell
1
star
37

htmlnote

Simple slideshow app in rails 3.1. Built to test out the new features in 3.1.
Ruby
1
star
38

passgen

Old project in c# originally for windows, but compiles in monodevelop too, to generate passwords based on two values.
C#
1
star
39

myleveleditor

My attempt to make a plugin based level editor. Project died out long ago.
C#
1
star
40

gobenchui-gui

A desktop application for gobenchui
JavaScript
1
star
41

phpSourceFormatter

Old project for formatting php code. Don't even remember how far I got.
PHP
1
star
42

tyda.pl

Simple command line tool to search tyda.se
Perl
1
star
43

minesweeper

Two minesweeper implementations using common library.
C++
1
star
44

ape

Simple project management application with wiki, tickets, milestones and scm integration.
Ruby
1
star