{"id":13601756,"url":"https://github.com/xalanq/cf-tool","last_synced_at":"2025-08-20T12:30:35.833Z","repository":{"id":37617444,"uuid":"179657521","full_name":"xalanq/cf-tool","owner":"xalanq","description":":bar_chart: Codeforces CLI (Submit, Parse, Test, etc.). Support Contests, Gym, Groups, acmsguru, Windows, macOS, Linux, 7 MB","archived":false,"fork":false,"pushed_at":"2024-07-30T14:31:26.000Z","size":2764,"stargazers_count":1323,"open_issues_count":79,"forks_count":225,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-12-12T10:03:37.391Z","etag":null,"topics":["cli","codeforces","cross-platform","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xalanq.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-05T09:51:39.000Z","updated_at":"2024-12-05T13:46:13.000Z","dependencies_parsed_at":"2022-07-12T16:33:55.400Z","dependency_job_id":"adaac7fc-3ba2-4573-9571-ed372af32b7c","html_url":"https://github.com/xalanq/cf-tool","commit_stats":{"total_commits":114,"total_committers":7,"mean_commits":"16.285714285714285","dds":"0.19298245614035092","last_synced_commit":"4aff8682ad0d1e14155c9744a3f27780576bb11e"},"previous_names":["xalanq/cf","xalanq/codeforces"],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xalanq%2Fcf-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xalanq%2Fcf-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xalanq%2Fcf-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xalanq%2Fcf-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xalanq","download_url":"https://codeload.github.com/xalanq/cf-tool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230423551,"owners_count":18223433,"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","codeforces","cross-platform","golang"],"created_at":"2024-08-01T18:01:07.571Z","updated_at":"2024-12-19T11:06:49.762Z","avatar_url":"https://github.com/xalanq.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Codeforces Tool\n\n[![Github release](https://img.shields.io/github/release/xalanq/cf-tool.svg)](https://github.com/xalanq/cf-tool/releases)\n[![platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-blue.svg)](https://github.com/xalanq/cf-tool/releases)\n[![Build Status](https://travis-ci.org/xalanq/cf-tool.svg?branch=master)](https://travis-ci.org/xalanq/cf-tool)\n[![Go Report Card](https://goreportcard.com/badge/github.com/xalanq/cf-tool)](https://goreportcard.com/report/github.com/xalanq/cf-tool)\n[![Go Version](https://img.shields.io/badge/go-%3E%3D1.12-green.svg)](https://github.com/golang)\n[![license](https://img.shields.io/badge/license-MIT-%23373737.svg)](https://raw.githubusercontent.com/xalanq/cf-tool/master/LICENSE)\n\nCodeforces Tool is a command-line interface tool for [Codeforces](https://codeforces.com).\n\nIt's fast, small, cross-platform and powerful.\n\n[Installation](#installation) | [Usage](#usage) | [FAQ](#faq) | [中文](./README_zh_CN.md)\n\n## Features\n\n* Support Contests, Gym, Groups and acmsguru.\n* Support all programming languages in Codeforces.\n* Submit codes.\n* Watch submissions' status dynamically.\n* Fetch problems' samples.\n* Compile and test locally.\n* Clone all codes of someone.\n* Generate codes from the specified template (including timestamp, author, etc.)\n* List problems' stats of one contest.\n* Use default web browser to open problems' pages, standings' page, etc.\n* Setup a network proxy. Setup a mirror host.\n* Colorful CLI.\n\nPull requests are always welcome.\n\n![](./assets/readme_1.gif)\n\n## Installation\n\nYou can download the pre-compiled binary file in [here](https://github.com/xalanq/cf-tool/releases).\n\nThen enjoy the cf-tool~\n\nOr you can compile it from the source **(go \u003e= 1.12)**:\n\n```plain\n$ go get github.com/xalanq/cf-tool\n$ cd $GOPATH/src/github.com/xalanq/cf-tool\n$ go build -ldflags \"-s -w\" cf.go\n```\n\nIf you don't know what's the `$GOPATH`, please see here \u003chttps://github.com/golang/go/wiki/GOPATH\u003e.\n\n## Usage\n\nLet's simulate a competition.\n\n `cf race 1136` or `cf race https://codeforces.com/contest/1136`\n\nTo start competing the contest 1136!\n\nIf the contest has not started yet, `cf` will count down. If the contest have started or the countdown ends, `cf` will use the default browser to open dashboard's page and problems' page, and fetch all samples to the local.\n\n `cd ./cf/contest/1136/a` (May be different from this, please notice the message on your screen)\n\nEnter the directory of problem A, the directory should contain all samples of the problem.\n\n `cf gen` \n\nGenerate a code with the default template. The filename of the code is problem id by default.\n\n `vim a.cpp` \n\nUse Vim to write the code (It depends on yourself).\n\n `cf test` \n\nCompile and test all samples.\n\n `cf submit` \n\nSubmit the code.\n\n `cf list` \n\nList problems' stats of the contest.\n\n `cf stand` \n\nOpen the standings' page of the contest.\n\n```plain\nYou should run \"cf config\" to configure your handle, password and code\ntemplates at first.\n\nIf you want to compete, the best command is \"cf race\".\n\nUsage:\n  cf config\n  cf submit [-f \u003cfile\u003e] [\u003cspecifier\u003e...]\n  cf list [\u003cspecifier\u003e...]\n  cf parse [\u003cspecifier\u003e...]\n  cf gen [\u003calias\u003e]\n  cf test [\u003cfile\u003e]\n  cf watch [all] [\u003cspecifier\u003e...]\n  cf open [\u003cspecifier\u003e...]\n  cf stand [\u003cspecifier\u003e...]\n  cf sid [\u003cspecifier\u003e...]\n  cf race [\u003cspecifier\u003e...]\n  cf pull [ac] [\u003cspecifier\u003e...]\n  cf clone [ac] [\u003chandle\u003e]\n  cf upgrade\n\nOptions:\n  -h --help            Show this screen.\n  --version            Show version.\n  -f \u003cfile\u003e, --file \u003cfile\u003e, \u003cfile\u003e\n                       Path to file. E.g. \"a.cpp\", \"./temp/a.cpp\"\n  \u003cspecifier\u003e          Any useful text. E.g.\n                       \"https://codeforces.com/contest/100\",\n                       \"https://codeforces.com/contest/180/problem/A\",\n                       \"https://codeforces.com/group/Cw4JRyRGXR/contest/269760\",\n                       \"1111A\", \"1111\", \"a\", \"Cw4JRyRGXR\"\n                       You can combine multiple specifiers to specify what you\n                       want.\n  \u003calias\u003e              Template's alias. E.g. \"cpp\"\n  ac                   The status of the submission is Accepted.\n\nExamples:\n  cf config            Configure the cf-tool.\n  cf submit            cf will detect what you want to submit automatically.\n  cf submit -f a.cpp\n  cf submit https://codeforces.com/contest/100/A\n  cf submit -f a.cpp 100A \n  cf submit -f a.cpp 100 a\n  cf submit contest 100 a\n  cf submit gym 100001 a\n  cf list              List all problems' stats of a contest.\n  cf list 1119\n  cf parse 100         Fetch all problems' samples of contest 100 into\n                       \"{cf}/{contest}/100/\".\n  cf parse gym 100001a\n                       Fetch samples of problem \"a\" of gym 100001 into\n                       \"{cf}/{gym}/100001/a\".\n  cf parse gym 100001\n                       Fetch all problems' samples of gym 100001 into\n                       \"{cf}/{gym}/100001\".\n  cf parse             Fetch samples of current problem into current path.\n  cf gen               Generate a code from default template.\n  cf gen cpp           Generate a code from the template whose alias is \"cpp\"\n                       into current path.\n  cf test              Run the commands of a template in current path. Then\n                       test all samples. If you want to add a new testcase,\n                       create two files \"inK.txt\" and \"ansK.txt\" where K is\n                       a string with 0~9.\n  cf watch             Watch the first 10 submissions of current contest.\n  cf watch all         Watch all submissions of current contest.\n  cf open 1136a        Use default web browser to open the page of contest\n                       1136, problem a.\n  cf open gym 100136   Use default web browser to open the page of gym\n                       100136.\n  cf stand             Use default web browser to open the standing page.\n  cf sid 52531875      Use default web browser to open the submission\n                       52531875's page.\n  cf sid               Open the last submission's page.\n  cf race 1136         If the contest 1136 has not started yet, it will\n                       countdown. When the countdown ends, it will open all\n                       problems' pages and parse samples.\n  cf pull 100          Pull all problems' latest codes of contest 100 into\n                       \"./100/\u003cproblem-id\u003e\".\n  cf pull 100 a        Pull the latest code of problem \"a\" of contest 100 into\n                       \"./100/\u003cproblem-id\u003e\".\n  cf pull ac 100 a     Pull the \"Accepted\" or \"Pretests passed\" code of problem\n                       \"a\" of contest 100.\n  cf pull              Pull the latest codes of current problem into current\n                       path.\n  cf clone xalanq      Clone all codes of xalanq.\n  cf upgrade           Upgrade the \"cf\" to the latest version from GitHub.\n\nFile:\n  cf will save some data in some files:\n\n  \"~/.cf/config\"        Configuration file, including templates, etc.\n  \"~/.cf/session\"       Session file, including cookies, handle, password, etc.\n\n  \"~\" is the home directory of current user in your system.\n\nTemplate:\n  You can insert some placeholders into your template code. When generate a code\n  from the template, cf will replace all placeholders by following rules:\n\n  $%U%$   Handle (e.g. xalanq)\n  $%Y%$   Year   (e.g. 2019)\n  $%M%$   Month  (e.g. 04)\n  $%D%$   Day    (e.g. 09)\n  $%h%$   Hour   (e.g. 08)\n  $%m%$   Minute (e.g. 05)\n  $%s%$   Second (e.g. 00)\n\nScript in template:\n  Template will run 3 scripts in sequence when you run \"cf test\":\n    - before_script   (execute once)\n    - script          (execute the number of samples times)\n    - after_script    (execute once)\n  You could set \"before_script\" or \"after_script\" to empty string, meaning\n  not executing.\n  You have to run your program in \"script\" with standard input/output (no\n  need to redirect).\n\n  You can insert some placeholders in your scripts. When execute a script,\n  cf will replace all placeholders by following rules:\n\n  $%path%$   Path to source file (Excluding $%full%$, e.g. \"/home/xalanq/\")\n  $%full%$   Full name of source file (e.g. \"a.cpp\")\n  $%file%$   Name of source file (Excluding suffix, e.g. \"a\")\n  $%rand%$   Random string with 8 character (including \"a-z\" \"0-9\")\n```\n\n## Template Example\n\nThe placeholders inside the template will be replaced with the corresponding content when you run `cf gen`.\n\n```\n$%U%$   Handle (e.g. xalanq)\n$%Y%$   Year   (e.g. 2019)\n$%M%$   Month  (e.g. 04)\n$%D%$   Day    (e.g. 09)\n$%h%$   Hour   (e.g. 08)\n$%m%$   Minute (e.g. 05)\n$%s%$   Second (e.g. 00)\n```\n\n```cpp\n/* Generated by powerful Codeforces Tool\n * You can download the binary file in here https://github.com/xalanq/cf-tool (Windows, macOS, Linux)\n * Author: $%U%$\n * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$\n**/\n\n#include \u003cbits/stdc++.h\u003e\nusing namespace std;\n\ntypedef long long ll;\n\nint main() {\n    ios::sync_with_stdio(false);\n    cin.tie(0);\n    \n    return 0;\n}\n```\n\n## FAQ\n\n### I double click the program but it doesn't work\n\nCodeforces Tool is a command-line tool. You should run it in terminal.\n\n### I cannot use `cf` command\n\nYou should put the `cf` program to a path (e.g. `/usr/bin/` in Linux) which has been added to system environment variable PATH.\n\nOr just google \"how to add a path to system environment variable PATH\".\n\n### How to add a new testcase\n\nCreate two extra testcase files `inK.txt` and `ansK.txt` (K is a string with 0~9).\n\n### Enable tab completion in terminal\n\nUse this [Infinidat/infi.docopt_completion](https://github.com/Infinidat/infi.docopt_completion).\n\nNote: If there is a new version released (especially a new command added), you should run `docopt-completion cf` again.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxalanq%2Fcf-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxalanq%2Fcf-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxalanq%2Fcf-tool/lists"}