{"id":26395720,"url":"https://github.com/tamada/wildcat","last_synced_at":"2025-09-03T08:38:26.898Z","repository":{"id":52469350,"uuid":"338797861","full_name":"tamada/wildcat","owner":"tamada","description":"another implementation of wc (word count) accepting archives, directories, and file lists.","archived":false,"fork":false,"pushed_at":"2022-09-18T02:47:11.000Z","size":5770,"stargazers_count":8,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-06-19T04:24:40.862Z","etag":null,"topics":["cli-app","docker","golang","rest-api","word-count"],"latest_commit_sha":null,"homepage":"https://tamada.github.io/wildcat","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tamada.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-14T12:13:34.000Z","updated_at":"2024-05-29T15:10:01.000Z","dependencies_parsed_at":"2022-09-13T18:50:35.952Z","dependency_job_id":null,"html_url":"https://github.com/tamada/wildcat","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamada%2Fwildcat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamada%2Fwildcat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamada%2Fwildcat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tamada%2Fwildcat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tamada","download_url":"https://codeload.github.com/tamada/wildcat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244022683,"owners_count":20385134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli-app","docker","golang","rest-api","word-count"],"created_at":"2025-03-17T11:19:05.377Z","updated_at":"2025-03-17T11:19:06.200Z","avatar_url":"https://github.com/tamada.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :cat2: wildcat\n\n![build](https://github.com/tamada/wildcat/workflows/build/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/tamada/wildcat/badge.svg?branch=main)](https://coveralls.io/github/tamada/wildcat?branch=main)\n[![codebeat badge](https://codebeat.co/badges/ad4259ff-15bc-48e6-b5a5-e23fda711d25)](https://codebeat.co/projects/github-com-tamada-wildcat-main)\n[![Go Report Card](https://goreportcard.com/badge/github.com/tamada/wildcat)](https://goreportcard.com/report/github.com/tamada/wildcat)\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?logo=spdx)](https://github.com/tamada/wildcat/blob/main/LICENSE)\n[![Version](https://img.shields.io/badge/Version-1.2.0-blue.svg)](https://github.com/tamada/tjdoe/releases/tag/v1.2.0)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4724442.svg)](https://doi.org/10.5281/zenodo.4724442)\n\n[![Docker](https://img.shields.io/badge/Docker-ghcr.io%2Ftamada%2Fwildcat%3A1.2.0-green?logo=docker)](https://github.com/users/tamada/packages/container/package/wildcat)\n[![Heroku](https://img.shields.io/badge/Heroku-secret--coast--70208-green?logo=heroku)](https://secret-coast-70208.herokuapp.com/wildcat/)\n[![tamada/brew/wildcat](https://img.shields.io/badge/Homebrew-tamada%2Fbrew%2Fwildcat-green?logo=homebrew)](https://github.com/tamada/homebrew-brew)\n\n[![Discussion](https://img.shields.io/badge/GitHub-Discussion-orange?logo=GitHub)](https://github.com/tamada/wildcat/discussions)\n\nAnother implementation of `wc` (word count).\n\n![wildcat](docs/static/images/logo.svg)\n\n## :speaking_head: Overview\n\n`wildcat` counts the lines, words, characters, and bytes of the given files and the files in the given directories.\nAlso, it respects the ignore files, such as `.gitignore`.\nThe excellent points than `wc` are as follows.\n\n- handles the files in the directories,\n- respects the `.gitignore` file,\n- reads files in the archive file such as jar, tar.gz, and etc.,\n- supports the several output formats,\n- accepts file list from file and stdin, and\n- includes REST API server.\n\nNote that this product is an example project for implementing Open Source Software.\n\n## :walking: Demo\n\n![demo](docs/static/images/demo.gif)\n\n## :runner: Usage\n\n### :shoe: CLI mode\n\n```shell\nwildcat version 1.2.0\nwildcat [CLI_MODE_OPTIONS|SERVER_MODE_OPTIONS] [FILEs...|DIRs...|URLs...]\nCLI_MODE_OPTIONS\n    -b, --byte                  Prints the number of bytes in each input file.\n    -c, --character             Prints the number of characters in each input file.\n                                If the given arguments do not contain multibyte characters,\n                                this option is equal to -b (--byte) option.\n    -l, --line                  Prints the number of lines in each input file.\n    -w, --word                  Prints the number of words in each input file.\n\n    -a, --all                   Reads the hidden files.\n    -f, --format \u003cFORMAT\u003e       Prints results in a specified format.  Available formats are:\n                                csv, json, xml, and default. Default is default.\n    -H, --humanize              Prints sizes in humanization.\n    -n, --no-ignore             Does not respect ignore files (.gitignore).\n                                If this option was specified, wildcat read .gitignore.\n    -N, --no-extract-archive    Does not extract archive files. If this option was specified,\n                                wildcat treats archive files as the single binary file.\n    -P, --progress              Shows progress bar for counting.\n    -o, --output \u003cDEST\u003e         Specifies the destination of the result.  Default is standard output.\n    -S, --store-content         Sets to store the content of url targets.\n    -t, --with-threads \u003cNUM\u003e    Specifies the max thread number for counting. (Default is 10).\n                                The given value is less equals than 0, sets no max.\n    -@, --filelist              Treats the contents of arguments as file list.\n\n    -h, --help                  Prints this message.\n    -v, --version               Prints the version of wildcat.\nSERVER_MODE_OPTIONS\n    -p, --port \u003cPORT\u003e           Specifies the port number of server.  Default is 8080.\n                                If '--server' option did not specified, wildcat ignores this option.\n    -s, --server                Launches wildcat in the server mode. With this option, wildcat ignores\n                                CLI_MODE_OPTIONS and arguments.\nARGUMENTS\n    FILEs...                    Specifies counting targets. wildcat accepts zip/tar/tar.gz/tar.bz2/jar/war files.\n    DIRs...                     Files in the given directory are as the input files.\n    URLs...                     Specifies the urls for counting files (accept archive files).\n\nIf no arguments are specified, the standard input is used.\nMoreover, -@ option is specified, the content of given files are the target files.\n```\n\n### :high_heel: Server Mode\n\nTo run `wildcat` with `--server` option, the wildcat start REST API server on port 8080 (default).\nThen, `wildcat` readies for the following endpoints.\n\n#### `POST /api/wildcat/counts`\n\ngives the files in the request body, then returns the results in the JSON format.\nThe example of results is shown in [Json](#json).\nAvailable query parameters are as follows.\n\n- `file-name=\u003cFILENAME\u003e`\n  - this query param gives filename of the content in the request body.\n- `readAs=no-extract`\n  - By specifying this query parameter, if client gives archive files, `wildcat` server does not extract archive files, and reads them as binary files.\n- `readAs=file-list`\n  - By specifying this query parameter, client gives url list as input for `wildcat` server.\n- `readAs=no-extract,file-list` or `readAs=no-extract\u0026readAs=file-list`\n  - This query parameter means the client requests the above both parameters.\n    That is, the request body is url list, and archive files in the url list are treats as binary files.\n    Note that, the order of `no-extract` and `file-list` does not care.\n\n### :envelope: Results\n\nThe available result formats are default, csv, json and xml.\nThe examples of results are as follows by executing `wildcat testdata/wc --format \u003cFORMAT\u003e`.\n\n#### Default\n\nDefault format is almost same as the result of `wc`.\n\n```shell\nlines      words characters      bytes\n    4         26        142        142 testdata/wc/humpty_dumpty.txt\n   15         26        118        298 testdata/wc/ja/sakura_sakura.txt\n   59        260      1,341      1,341 testdata/wc/london_bridge_is_broken_down.txt\n   78        312      1,601      1,781 total (3 entries)\n```\n\n#### Csv\n\n```csv\nfile name,lines,words,characters,bytes\ntestdata/wc/humpty_dumpty.txt,\"4\",\"26\",\"142\",\"142\"\ntestdata/wc/ja/sakura_sakura.txt,\"15\",\"26\",\"118\",\"298\"\ntestdata/wc/london_bridge_is_broken_down.txt,\"59\",\"260\",\"1,341\",\"1,341\"\ntotal,\"78\",\"312\",\"1,601\",\"1,781\"\n```\n\n#### Json\n\nThe following json is formatted by `jq .`.\n\n```JSON\n{\n  \"timestamp\": \"2021-02-16T14:59:40+09:00\",\n  \"results\": [\n    {\n      \"filename\": \"testdata/wc/humpty_dumpty.txt\",\n      \"lines\": \"4\",\n      \"words\": \"26\",\n      \"characters\": \"142\",\n      \"bytes\": \"142\"\n    },\n    {\n      \"filename\": \"testdata/wc/ja/sakura_sakura.txt\",\n      \"lines\": \"15\",\n      \"words\": \"26\",\n      \"characters\": \"118\",\n      \"bytes\": \"298\"\n    },\n    {\n      \"filename\": \"testdata/wc/london_bridge_is_broken_down.txt\",\n      \"lines\": \"59\",\n      \"words\": \"260\",\n      \"characters\": \"1,341\",\n      \"bytes\": \"1,341\"\n    },\n    {\n      \"filename\": \"total\",\n      \"lines\": \"78\",\n      \"words\": \"312\",\n      \"characters\": \"1,601\",\n      \"bytes\": \"1,781\"\n    }\n  ]\n}\n```\n\n#### Xml\n\nThe following xml is formatted by `xmllint --format -`\n\n```xml\n\u003c?xml version=\"1.0\"?\u003e\n\u003cwildcat\u003e\n  \u003ctimestamp\u003e2021-02-16T14:58:06+09:00\u003c/timestamp\u003e\n  \u003cresults\u003e\n    \u003cresult\u003e\n      \u003cfile-name\u003etestdata/wc/humpty_dumpty.txt\u003c/file-name\u003e\n      \u003clines\u003e4\u003c/lines\u003e\n      \u003cwords\u003e26\u003c/words\u003e\n      \u003ccharacters\u003e142\u003c/characters\u003e\n      \u003cbytes\u003e142\u003c/bytes\u003e\n    \u003c/result\u003e\n    \u003cresult\u003e\n      \u003cfile-name\u003etestdata/wc/ja/sakura_sakura.txt\u003c/file-name\u003e\n      \u003clines\u003e15\u003c/lines\u003e\n      \u003cwords\u003e26\u003c/words\u003e\n      \u003ccharacters\u003e118\u003c/characters\u003e\n      \u003cbytes\u003e298\u003c/bytes\u003e\n    \u003c/result\u003e\n    \u003cresult\u003e\n      \u003cfile-name\u003etestdata/wc/london_bridge_is_broken_down.txt\u003c/file-name\u003e\n      \u003clines\u003e59\u003c/lines\u003e\n      \u003cwords\u003e260\u003c/words\u003e\n      \u003ccharacters\u003e1,341\u003c/characters\u003e\n      \u003cbytes\u003e1,341\u003c/bytes\u003e\n    \u003c/result\u003e\n    \u003cresult\u003e\n      \u003cfile-name\u003etotal\u003c/file-name\u003e\n      \u003clines\u003e78\u003c/lines\u003e\n      \u003cwords\u003e312\u003c/words\u003e\n      \u003ccharacters\u003e1,601\u003c/characters\u003e\n      \u003cbytes\u003e1,781\u003c/bytes\u003e\n    \u003c/result\u003e\n  \u003c/results\u003e\n\u003c/wildcat\u003e\n```\n\n### :whale: Docker\n\n[![Docker](https://img.shields.io/badge/Docker-ghcr.io%2Ftamada%2Fwildcat%3A1.2.0-green?logo=docker)](https://github.com/users/tamada/packages/container/package/wildcat)\n\n```shell\n$ docker run -v $PWD:/home/wildcat ghcr.io/tamada/wildcat:1.2.0 testdata/wc\n```\n\nIf you run `wildcat` on server mode, run the following command.\n\n```shell\n$ docker run -p 8080:8080 -v $PWD:/home/wildcat ghcr.io/tamada/wildcat:1.2.0 --server\n```\n\n#### versions\n\n- `1.2.0`, `latest`\n- `1.1.1`\n- `1.1.0`\n- `1.0.3`\n- `1.0.2`\n- `1.0.1`\n- `1.0.0`\n\n### :surfer: Heroku\n\n[![Heroku](https://img.shields.io/badge/Heroku-secret--coast--70208-green?logo=heroku)](https://secret-coast-70208.herokuapp.com/wildcat/)\n\nPost the files to `https://secret-coast-70208.herokuapp.com/wildcat/api/counts`, like below.\n\n```\n$ curl -X POST --data-binary @testdata/archives/wc.jar https://secret-coast-70208.herokuapp.com/wildcat/api/counts\n{\"timestamp\":\"2021-02-22T02:40:35+09:00\",\"results\":[{\"filename\":\"\u003crequest\u003e!humpty_dumpty.txt\",\"lines\":4,\"words\":26,\"characters\":142,\"bytes\":\"142\"},{\"filename\":\"\u003crequest\u003e!ja/\",\"lines\":\"0\",\"words\":\"0\",\"characters\":\"0\",\"bytes\":\"0\"},{\"filename\":\"\u003crequest\u003e!ja/sakura_sakura.txt\",\"lines\":\"15\",\"words\":\"26\",\"characters\":\"118\",\"bytes\":\"298\"},{\"filename\":\"\u003crequest\u003e!london_bridge_is_broken_down.txt\",\"lines\":\"59\",\"words\":\"260\",\"characters\":\"1,341\",\"bytes\":\"1,341\"},{\"filename\":\"total\",\"lines\":78,\"words\":\"312\",\"characters\":\"1,601\",\"bytes\":\"1,781\"}]}\n```\n\n## :anchor: Install\n\n### :beer: Homebrew\n\n[![tamada/brew/wildcat](https://img.shields.io/badge/Homebrew-tamada%2Fbrew%2Fwildcat-green?logo=homebrew)](https://github.com/tamada/homebrew-brew)\n\n```shell\n$ brew tap tamada/brew\n$ brew install wildcat\n```\n\n### :muscle: Compiling yourself\n\n```shell\n$ git clone https://github.com/tamada/wildcat.git\n$ cd wildcat\n$ make\n```\n\n## :smile: About\n\n### Cite `wildcat` in the academic papers\n\n[![DOI](https://zenodo.org/badge/338797861.svg)](https://zenodo.org/badge/latestdoi/338797861)\n\nTo cite this product, use the following BibTeX entry.\n\n```latex\n@misc{ tamada_wildcat,\n    author       = {Haruaki Tamada},\n    title        = {Wildcat: another implementation of wc (word count)},\n    publisher    = {GitHub},\n    howpublished = {\\url{https://github.com/tamada/wildcat}},\n    year         = {2021},\n}\n```\n\n### :jack_o_lantern: Icon\n\n![wildcat](docs/static/images/logo.svg)\n\nThis icon is obtained from [freesvg.org](https://freesvg.org/1527045310).\n\n### :name_badge: The project name (`wildcat`) comes from?\n\nThis project origin is `wc` command, and `wc` is the abbrev of 'word count.'\n\nWildcat can abbreviate as `wc`, too.\n\n### :man_office_worker: Developers :woman_office_worker:\n\n- [tamada](https://tamada.github.io)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftamada%2Fwildcat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftamada%2Fwildcat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftamada%2Fwildcat/lists"}