用于竞争性编程的命令行工具
coolkit的Python项目详细描述
冷却套件
coolkit是Coding + ToolKit
,一种用于自动化编程体验的命令行工具。
安装
使用pip安装
- 使用pip安装,用户
--user
标志
sudo python3 -m pip install coolkit
从源代码生成
- 克隆存储库并签出到稳定提交
git clone https://github.com/srbcheema1/CoolKit
cd CoolKit
git checkout <latest_version say: v0.0.x>
- 安装要求
python3 -m pip install --user -r requirements.txt
- 安装CoolKit
python3 setup.py install --user
验证安装
- 检查工作情况
coolkit --help
- 如果显示“帮助”消息,则表示您已准备就绪。
故障排除
如果coolkit -h
不工作,请确保二进制路径在路径中。
在~/.bashrc
或~/.zshrc
中添加export PATH=$PATH:"~/.local/bin"
行。
bash用户运行这些命令
echo export PATH="$PATH":"~/.local/bin" >> ~/.bashrc
source ~/.bashrc
- zsh用户运行这些命令
echo export PATH="$PATH":"~/.local/bin" >> ~/.zshrc
source ~/.zshrc
让它更聪明
- 强烈建议使用此功能充分发挥CoolKit的潜力
- 您可以使用CoolKit从文件和目录的命名中自动检测
contest
和problem
。 - 为此,您需要在
~/.config/coolkit/global_config.py
中重新定义get_contest_name
和get_problem_name
。 - 您可以定义自己的函数或通过取消注释以下行来使用预构建函数:
# return srb_contest_name(folder)
# return srb_problem_name(file_name)
- 请随意ping我在
srbcheema2@gmail.com
上,根据您的命名为您制作一个global_config.py
文件。
使用量
srb@srb-pc:$ coolkit --help
usage: Coolkit [-h] [-v] {init,set,run,submit,fetch,config,view} ...
positional arguments:
{init,set,run,submit,fetch,config,view}
optional arguments:
-h, --help show this help message and exit
-v, --version display version number
suboptions are:
init initilize a directory as coolkit directory
set set value of coolkit variables.
config set config values like username, password.
fetch fetch a contest to use it for offline testing.
run run a code file against provided testcases
submit submit a code to online judge. and output the verdict.
view view a user, contest, problem, friends-standings or upcoming contest
For more help regarding suboptions run:
coolkit init -h
coolkit set -h
coolkit config -h
coolkit fetch -h
coolkit run -h
coolkit submit -h
coolkit view -h
支持的站点
- 共作用力
示例
初始化
--user
标志sudo python3 -m pip install coolkit
- 克隆存储库并签出到稳定提交
git clone https://github.com/srbcheema1/CoolKit
cd CoolKit
git checkout <latest_version say: v0.0.x>
- 安装要求
python3 -m pip install --user -r requirements.txt
- 安装CoolKit
python3 setup.py install --user
验证安装
- 检查工作情况
coolkit --help
- 如果显示“帮助”消息,则表示您已准备就绪。
故障排除
如果
coolkit -h
不工作,请确保二进制路径在路径中。 在~/.bashrc
或~/.zshrc
中添加export PATH=$PATH:"~/.local/bin"
行。bash用户运行这些命令
echo export PATH="$PATH":"~/.local/bin" >> ~/.bashrc
source ~/.bashrc
- zsh用户运行这些命令
echo export PATH="$PATH":"~/.local/bin" >> ~/.zshrc
source ~/.zshrc
让它更聪明
- 强烈建议使用此功能充分发挥CoolKit的潜力
- 您可以使用CoolKit从文件和目录的命名中自动检测
contest
和problem
。 - 为此,您需要在
~/.config/coolkit/global_config.py
中重新定义get_contest_name
和get_problem_name
。 - 您可以定义自己的函数或通过取消注释以下行来使用预构建函数:
# return srb_contest_name(folder)
# return srb_problem_name(file_name)
- 请随意ping我在
srbcheema2@gmail.com
上,根据您的命名为您制作一个global_config.py
文件。
使用量
srb@srb-pc:$ coolkit --help
usage: Coolkit [-h] [-v] {init,set,run,submit,fetch,config,view} ...
positional arguments:
{init,set,run,submit,fetch,config,view}
optional arguments:
-h, --help show this help message and exit
-v, --version display version number
suboptions are:
init initilize a directory as coolkit directory
set set value of coolkit variables.
config set config values like username, password.
fetch fetch a contest to use it for offline testing.
run run a code file against provided testcases
submit submit a code to online judge. and output the verdict.
view view a user, contest, problem, friends-standings or upcoming contest
For more help regarding suboptions run:
coolkit init -h
coolkit set -h
coolkit config -h
coolkit fetch -h
coolkit run -h
coolkit submit -h
coolkit view -h
支持的站点
- 共作用力
示例
初始化
contest
和problem
。~/.config/coolkit/global_config.py
中重新定义get_contest_name
和get_problem_name
。# return srb_contest_name(folder)
# return srb_problem_name(file_name)
srbcheema2@gmail.com
上,根据您的命名为您制作一个global_config.py
文件。srb@srb-pc:$ coolkit --help
usage: Coolkit [-h] [-v] {init,set,run,submit,fetch,config,view} ...
positional arguments:
{init,set,run,submit,fetch,config,view}
optional arguments:
-h, --help show this help message and exit
-v, --version display version number
suboptions are:
init initilize a directory as coolkit directory
set set value of coolkit variables.
config set config values like username, password.
fetch fetch a contest to use it for offline testing.
run run a code file against provided testcases
submit submit a code to online judge. and output the verdict.
view view a user, contest, problem, friends-standings or upcoming contest
For more help regarding suboptions run:
coolkit init -h
coolkit set -h
coolkit config -h
coolkit fetch -h
coolkit run -h
coolkit submit -h
coolkit view -h
初始化空存储库
srb@srb-pc:$ coolkit init
设置
为比赛、prob、site、比赛类型设置coolkit变量值
srb@srb-pc:$ coolkit set -c 535
srb@srb-pc:$ coolkit set -p A
srb@srb-pc:$ coolkit set -t gym
配置
设置全局配置变量的值,如用户名、密码
srb@srb-pc:$ coolkit config --user srbcheema1
srb@srb-pc:$ coolkit config --pswd I_wont_write_it_here_xD
获取
获取一个竞赛,如果您站在CoolKit文件夹中,那么默认情况下,它将获取该文件夹中配置的竞赛,除非您使用-c
选项提供。在coolkit repo之外,必须使用-c
srb@srb-pc:$ coolkit fetch
srb@srb-pc:$ coolkit fetch -c 1025
运行
对样本测试用例运行问题。您可以使用-p
选项提供问题名称,如果您不提供问题名称,它将尝试使用~/.config/coolkit/global_config.py
中指定的规则自动检测问题名称。您可以根据需要修改此文件。
如果无法检测到文件名,则它将尝试记住上次运行的问题,并针对该问题运行测试用例。
srb@srb-pc:$ coolkit run one.cpp
Prob name not provided, trying to detect from filename
running one.cpp file for A prob on 837
srb@srb-pc:$ coolkit run soln.cpp
Prob name not provided, trying to detect from filename
Unable to detect prob name from file name
有一个很酷的新特性:您可以在run命令期间添加自己的自定义输入/输出来测试二进制文件。只需将它们添加到当前工作目录Input.txt
和Output.txt
中,分别包含输入和输出。
提交
提交一个在线法官文件,并通过桌面通知显示您的报告。如果在本地示例测试用例中失败,则不会提交文件。如果仍要提交文件,请使用-f
标志
srb@srb-pc:$ coolkit submit one.cpp
srb@srb-pc:$ coolkit submit one.cpp -p A
srb@srb-pc:$ coolkit submit one.cpp -p A -f
视图
srb@srb-pc:$ coolkit view user srbcheema1
srb@srb-pc:$ coolkit view prob A
srb@srb-pc:$ coolkit view contest 535
srb@srb-pc:$ coolkit view upcoming
srb@srb-pc:$ coolkit view friends
srb@srb-pc:$ coolkit view standings
竞赛演示
类似工具
注
- coolkit足够聪明,可以检测目录是否为coolkit repo。如果目录不是coolkit目录,它会自动初始化该目录。我仍然提供了
init
选项。它的主要目的是初始化另一个coolkit目录中的coolkit目录。默认情况下,它将复制父配置一次,您可以在以后进行更改。 - CoolKit足够聪明,可以从文件名中检测程序名。查看
global_config.py
文件中的get_problem_name
。你可以在那个函数中提出重要的建议。 - 一氧化碳olkit足够聪明,可以从目录名中检测到您的竞赛名称。查看
global_config.py
文件中的get_contest_name
。你可以在那个函数中提出重要的建议。 - 为了向我建议改进,你可以打开一个问题,做一个公关,给我发邮件或联系我在下面提供的链接。我正在努力为用户提供灵活的方式来修改他们自己的检测方式。
- 如果有任何错误/问题,请向srbcheema2@gmail.com报告。或者,更好的是,提交一个公关来修复它!
联系人/社交媒体
由
开发开发人员/作者:Srb Cheema