Skip to content

User manual

Roope Salmi edited this page Oct 25, 2021 · 5 revisions

Running the program

Download the latest release from the project's repository. The file can be run from the directory it is in, but if you want to install the program as a part of your system and be able to use it anywhere you can check out the installation guide.

Note: The course/contest ID parameter (-c) is remembered after it is used and does not need to be entered again unless a new course/contest needs to be specified or you log out.

Available commands

All the program's features are run with separate commands. Every command should start with cses-cli (or whatever name you have the utility installed as) followed by a blank space and the parameters for each feature. If you have not installed the program on your system, but only downloaded the binary, you should use ./cses-cli instead of cses-cli.

help

$ cses-cli help

Description:
Lists all the available commands and additional options.

login

$ cses-cli login

Description:
Lets the user log in with their CSES, MOOC or Putka account. The user is given a login link which they can use to log in through a browser of their choice. If a user is already logged in they are asked if they want to overwrite the current login. Login tokens used during sessions are always saved to the same directory on the user's system, so multiple instances of the program can be run from different directories without having to log in again.

logout

$ cses-cli logout

Description:
The user is logged out if they're logged in.

status

$ cses-cli status

Description:
Informs the user of whether they're logged in or not.

courses

$ cses-cli courses

Description:
Fetches and displays available courses, their course ID and description. Some courses may be hidden from users who are not logged in.

list

$ cses-cli list -c <course/contest ID>

Description:
Lists the content of the specified course/contest. This includes general links and available tasks. The tasks' status (pass/fail/none) based on previous submissions is displayed if the user is logged in. Otherwise it is just displayed as none.

submit

$ cses-cli submit <file> -c <course/contest ID> -t <task ID> -l <language> -o <language option>

Description: Submits a file from the current directory to cses.fi. The parameters can be given in any order.

  • Required arguments
    • <file>: This parameter is used to determine what file in the current directory should be submitted.
  • Optional arguments
    • -c <course/contest ID>: The ID of the course/contest.
    • -t <task ID>: The task's ID. If it is not given the server will try to identify the task based on the submitted file's name.
    • -l <language>: The programming language used. If it is not used the server will try to identify the task based on the submitted file's file extension.
    • -o <option>: Additional option for the programming language used (e.g. C++11 or C++17 if C++ is used).

submissions

$ cses-cli submissions -c <course/contest ID> -t <task ID>

Description:
Lists previous submissions to a task in the specified course/contest. The parameters can be given in any order.

  • Required arguments
    • -t <task id>: The task's ID.
  • Optional arguments
    • -c <course/contest ID>: The ID of the course/contest.

submission

$ cses-cli submission -c <course/contest ID> <submission ID>

Description:
Displays info about the specified submission to a task.

  • Required arguments
    • <submission id>: The submission's ID
  • Optional arguments
    • -c <course/contest ID>: The ID of the course/contest.

template

$ cses-cli template -c <course/contest ID> -f <file> -t <task ID> -l <language> -s <section> --all

Description:
Downloads a code template for a task to the current directory. The server will decide what kind of template is downloaded based on the given parameters.

It is also possible to download multiple templates at once: a given section with -s or all with --all.

  • Optional arguments
    • -c <course/contest ID>: The ID of the course/contest.
    • -f <file>: The file's name.
    • -t <task ID>: The task's ID
    • -l <language>: The programming language wanted for the template(s).
    • -s <section>: Download all course/contest templates in the section with the given number, starting from 1.
    • --all: Download all templates in the course or contest.

Examples of usage

$ cses-cli template -c tira21k -t 2244 -l Python3  
$ cses-cli template -f onechar.py
# Download all templates for Week 5 of Tira
$ cses-cli template -c tira21k -s 5

view

$ cses-cli view -c <course/contest ID> -t <task ID>

Description:
Displays the statement of a task.

  • Required arguments
    • -t <task ID>: The task's ID.
  • Optional arguments
    • -c <course/contest ID>: The ID of the course/contest.

examples

$ cses-cli examples -c <course/contest ID> -t <task ID> <directory>

Description:
Downloads example inputs and outputs for a task.

  • Required arguments
    • -t <task ID>: The task's ID.
  • Optional arguments
    • -c <course/contest ID>: The ID of the course/contest.
    • <directory>: The directory where the downloaded examples should be saved. If this parameter is not given the examples are saved in the current directory.
Clone this wiki locally