Command line interface for CodeAssign
This document describes the installation and usage of the CodeAssign CLI.
The CLI is used for testing some or all test cases of a given problem.
After you installed cae
on your computer be sure to checkout our Hello World! Guide. And if you are having trouble with running your solution of Hello World! problem, be sure to checkout our solutions in 6 different languages: Python2, Python3, C, C++, Ruby, Bash and Java.
CodeAssign CLI works on Windows and Linux. We created stand-alone executables for these platforms so you don't have to worry about any dependantcies. Please, follow instructions for your platform. If your platform isn't listed or stand-alone executable version doesn't work on your computer, checkout universal instructions.
Just download cae.exe
here. You can find this file in windows
folder of this project.
Your cae.exe
is now probably saved in your C:\Users\<YOUR USERNAME>\Downloads
folder. If you now open cmd.exe
in this folder, you will be able to run cae
command. And if you do this you will get this message: No arguments given! Use "cae help" for instructions.
, and that's OK!
You are now ready to test your Hello World! solution. Be sure to check our Hello World! Guide if you have any trouble solving and evaluating this example.
The above guide explains simplest and minimum steps that you have to do before running cae
command. But now your CMD
only knows about cae
command if you position yourself in the folder where cae
is located, i.e. probably your C:\Users\<YOUR USERNAME>\Downloads
. If you want your CMD
to know about your cae
command in the whole system (i.e. you will be able to run cae
anywhere in your CMD
), this is what you need to do:
-
Copy
cae.exe
somewhere safe. We suggest you to create aCodeAssign
folder in yourC:\
drive and placecae.exe
there. So nowcae.exe
will be located inC:\CodeAssign\cae.exe
. -
Open your Control Panel and go to System and Security > System.
-
On the left you will see Advanced system settings. Click on that and new window should open.
-
Now click on Advanced tab, and there at the bottom of the window you should see Environment Variables... button. Click on that button and new window should open.
-
In this window you should see two sections:
User variables for <YOUR USERNAME>
andSystem variables
. In this second section find and select variable calledPath
. -
With the variable
Path
selected click Edit... button (new window should open). -
Depending on Windows version you have you will see either: nice table with some paths, or old and dirty text filed with paths separated with
;
:- If you see a table, click on the New button and enter
C:\CodeAssign\
. - If you see old and dirty text field enter:
;C:\CodeAssign\
. DON'T FORGET;
BEFORE YOUR PATH.
- If you see a table, click on the New button and enter
-
Click OK as many times as you can to exit from all windows.
-
Restart your PC.
-
Open your
CMD
and typecae
. You should again see this message:No arguments given! Use "cae help" for instructions.
, and that's OK! -
You are now ready to test your Hello World! solution. Be sure to check our Hello World! Guide if you have any trouble solving and evaluating this example.
-
Download or clone this project.
-
Copy
linux/cae
in/usr/local/bin
folder
$ sudo cp linux/cae /usr/local/bin
- Make sure
cae
is executable
$ sudo chmod +x /usr/local/bin/cae
- You are now ready to test your Hello World! solution. Be sure to check our Hello World! Guide if you have any trouble solving and evaluating this example.
If your platform isn't listed above or the precompiled version we provide doesn't work on your computer, please follow these instructions.
$ pip install requests
$ pip install clint
-
You should now be able to run
cae.py
. -
You are now ready to test your Hello World! solution. Be sure to check our Hello World! Guide if you have any trouble solving and evaluating this example.
After completing Universal steps above you can create stand-alone executable for your system. First install pyinstaller
using pip
:
$ pip install pyinstaller
Then for Linux or OSX run build_linux.sh
script and for Windows run build_windows.bat
script.
Your executable will be present in linux
or windows
folder.
The keyword used is cae
(CodeAssign evaluate):
cae {problemId} {pathToExecutable} {testCaseIds}(optional) {additionalOptions}(optional)
$ cae 476 main/main.exe
$ cae 476 main/main.exe 1,2,4
$ cae 476 main/main.exe 5-7 -less
$ cae 476 main/main.exe 4..6 -more
The first parameter is the problemId
, this is the id od the problem you want to test. This id can be found next to the problem name.
The second parameter is the path to your program executable. The path can be relative or apsolute.
Examples of correctly formated paths:
-
/main/main.exe
-
MyProgram\bin\main.exe
-
C:/User/user/Desktop/main.exe
With this paremeter you can specify which test cases you want to run. If left blank, all test cases will be run.
1,2,3
4-7
3..6
Last but not least, enter any extra options you might find useful:
Will display only the most important information on the screen. This info is saved in ~/.codeassign
for later uses. If you want to revert this use -more
.
Will display everything (including user info) to the screen. This info is saved in ~/.codeassign
for later uses. If you want to revert this use -less
.
For first time usage you will be prompted to enter the token associated to your account. The tokens for your account can be generated here (login required). Tokens are just used to identify who you are on CodeAssign.
If the token is valid, it will be saved in ~/.codeassign
file. Feel free to modify the file if you want to change your token number.
The main file that does all the testing work.
This file is made after the first usage of CLI and consists of two (2) lines:
The first line has your token : TOKEN="xxxxxxxx
The second line saves info about your information display option (-less
and -more
).