Wikipediaを使うと様々な情報を素早く調べることができます。しかし読んでいる内に面白くなって、ついついリンク先まで調べてはじめて気がついたら数時間経っていた…なんてことも少なくありません。 そんなミスを防止するために使ってみたいのがwikiというコマンドです。Wikipediaのコンテンツをサマリーにして取得できます。

wikiの使い方

wikiはGoで作られていますのでgo getでインストールできます。

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

後はwikiコマンドの後に調べたいキーワードを入れるだけです。

$ 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)

日本のWikipediaの場合はWIKI_LANG変数にjaと設定します。

$ WIKI_LANG="ja" wiki "オープンソース"
オープンソース (open source) とは、言葉通りにはソースコードを公開することと理解できる。Open Source Initiative は,「オープンソース」と名乗るための要件を定義している(後述)。
History of the OSIによれば、1998年2月3日に、パロアルトにおいて、Netscapeブラウザのソースコードをどのような形で公開していくかという戦略会議の中でつけられた新たな用語であると説明している。またオープンソースに関する本 "Open Sources: Voices from the Open Source Revolution" にも、マーケット向けのプロモーション用語として使う新しい言葉“オープンソース”を作り出したとある。

Read more: https://ja.wikipedia.org/wiki/オープンソース

サマリーなのでキーワードの意味は分かりつつ、短いのでそこだけですぐに調べ物が完了します。コマンドヘルプです。

$ wiki -h
wiki is a tool used to fetch excerpts 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.

他のWikiエンジンでも調べられるのですが、アンサイクロンペディアを設定してもうまく調べられませんでした。Webブラウザで調べ出すと止まらなくなってしまう可能性がありますのでwikiコマンドでささっと調べるのが良さそうです。

wikiはGo製、MIT Licenseのオープンソース・ソフトウェアです。

walle/wiki