kurly - Go製のcurl代替コマンド
CLIでインターネット上にあるコンテンツを取得しようと思うと使われるのがwgetかcurlでしょう。特にファイルを送信したり、よりカスタマイズされたリクエストを行う際にはcurlが使われるかと思います。 今回はその代替と言えるソフトウェアkurlyを紹介します。Goで作られているのも特徴です。
kurlyの使い方
リクエスト例です。-vで細かな情報を出せます。
$ ./kurly -v https://www.moongift.jp/
> GET / HTTP/1.1
> User-Agent [Kurly/1.0]
> Accept [*/*]
> Host [www.moongift.jp]
< HTTP/1.1 200 OK
< Server [ngx_openresty/1.2.8.6]
< Date [Mon, 08 May 2017 07:57:58 GMT]
< Content-Type [text/html; charset=utf-8]
< Content-Length [68707]
< Connection [keep-alive]
<!DOCTYPE HTML> ] 0 B/68.7 KB
<html lang="ja" xmlns:fb="http://ogp.me/ns/fb#">
<head>
:
オプションです。
NAME:
kurly - [options] URL
USAGE:
kurly [global options] command [command options] [arguments...]
VERSION:
1.0.0
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--output value, -o value Filename to name url content to
--upload-file value, -T value File to upload
--remote-name, -O Save output to file named with file part of URL
-v Verbose output
--max-time value, -m value Maximum time to wait for an operation to complete in seconds (default: 0)
-R Set the timestamp of the local file to that of the remote file, if available
--location, -L Follow 3xx redirects
--max-redirs value Maximum number of 3xx redirects to follow (default: 10)
--silent, -s Mute kurly entirely, operation without any output
--request value, -X value HTTP method to use (default: "GET")
--user-agent value, -A value User agent to set for this request (default: "Kurly/1.0")
--header value, -H value Extra headers to be sent with the request
--expect100-timeout value Timeout in seconds for Expect: 100-continue wait period (default: 1)
--data value, -d value Sends the specified data in a POST request to the server
--data-ascii value The same as --data, -d
--data-raw value Basically the same as --data-binary (no @ interpretation)
--data-binary value Sends the data as binary
--data-urlencode value Sends the data as urlencoded ascii
--help, -h show help
--version, -V print the version
kurlyではファイルのアップロードやユーザエージェントの変更、ヘッダーの指定などcurlでできるような機能はほぼできます。そしてGoで作られている分、カスタマイズしやすいという方も多いのではないでしょうか。
kurlyはGo製のオープンソース・ソフトウェア(Apache Licnese 2.0)です。
davidjpeacock/kurly: kurly is an alternative to the widely popular curl program, written in Golang.