assignment_packer 0.1.0

Packs C assignment submissions for Canvas upload
assignment_packer-0.1.0 is not a library.

ap

CLI tool that builds the exact folder + zip structure Canvas wants for C assignment submissions.

Install

Cargo (any platform)

cargo install assignment_packer

Homebrew (macOS/Linux)

brew tap cat-forgor/ap https://github.com/cat-forgor/AssignmentPacker

brew install ap

Scoop (Windows)

scoop bucket add ap https://github.com/cat-forgor/AssignmentPacker
scoop install ap

Chocolatey (Windows)

choco install ap

WinGet (Windows)

winget install cat-forgor.ap

AUR (Arch Linux)

yay -S ap-bin

Debian/Ubuntu (.deb)

Download the .deb from releases:

sudo dpkg -i ap_*.deb

Windows Installer (.msi)

Download ap-windows-x64.msi from releases and run it. Installs to Program Files and adds ap to your PATH automatically.

Pre-built binaries

Grab the latest binary from releases.

Windows: rename to ap.exe and add to your PATH.

Linux/macOS:

chmod +x ap-linux-x64

mv ap-linux-x64 ~/.local/bin/ap

From source

Requires Rust 1.85+ (edition 2024):

cargo install --path .

Quick start

ap init                       # setup

ap -a 7 -c main.c --auto-doc  # pack assignment 7 with auto-generated doc (no setup example)

After ap init, you don't need to pass your id or name or auto-doc each time

Usage

# full command with auto-doc

ap -a 7 -n JoeBloggs -i 123456789 -c main.c --auto-doc


# bring your own doc instead

ap -a 7 -n JoeBloggs -i 123456789 -c main.c -d Assignment7_JoeBloggs_123456789.doc


# minimal (if you used ap init)

ap -a 7

Flags

Flag Short Description
--assignment -a Assignment number or label (e.g. 7 or Assignment7)
--name -n Student name
--id -i Student ID
--c-file -c Path to .c file (auto-detected if only one in cwd)
--doc-file -d Path to an existing .doc file
--auto-doc Generate .doc automatically
--run-command Custom shell command to run the program
--theme -t Screenshot theme (default, light, dracula, monokai, solarized)
--output-dir -o Output directory (defaults to .)
--force -f Overwrite existing output

Config

ap config set --name JoeBloggs --id 123456789 --auto-doc true

ap config show

ap config reset

ap config editor   # open config in your editor

See ap config set --help for all options. Config values are used as defaults and can be overridden by flags.

You can set a preferred editor with ap config set --editor "code --wait". Otherwise it checks $VISUAL, $EDITOR, then probes for common editors in PATH.

Auto-doc

When --auto-doc is enabled, ap will:

  1. Find gcc or clang and compile your .c file
  2. Run the binary and capture stdout/stderr
  3. Render a terminal screenshot as a PNG
  4. Generate an RTF .doc containing your source code, the screenshot, and captured output

Pass --run-command if you need a custom compile/run step (e.g. --run-command "make && ./myprogram").

Themes

The screenshot in the generated doc uses a terminal-style theme. Built-in options:

default light dracula monokai solarized

ap -a 7 -c main.c --auto-doc --theme dracula

You can also create custom themes as TOML files in ~/.config/assignment_packer/themes/:

# ~/.config/assignment_packer/themes/nord.toml

bg = "#2E3440"

fg = "#D8DEE9"

scale = 2    # 1-4

padding = 16 # max 64

font = "JetBrainsMono-Regular.ttf" # in themes dir, or absolute path

font_size = 16                     # pixel height (8-72)

Then use it with --theme nord.

Notes

  • --force overwrites existing output folders and zips
  • All non-binary files in the current directory are copied into the submission folder
  • If no .doc is provided and --auto-doc is off, the submission is created without one (with a warning)