GovTechSG/purple-a11y

It should be possible to script the execution

mgifford opened this issue · 2 comments

I'd love to be able to run this on a bunch of sites from the command line. Even just being able to execute it on cron, so that every Sunday night so we have a fresh report to look at every week. 

The current approach doesn't allow for an execution like this. The Desktop and CLI Interface are nice if you want to scan a web site every once in a while, but after a few weeks you really don't want to go through the steps of doing this by hand.

you already can. for example

node cli.js -c 2 -o siturl1-a11y-scan-results.zip -u https://site1.com -d 'iPad (gen 7) landscape' -k "yourname:youremai@example.com"

Were you looking for something different

I see in your closed #9 you wanted something even simpler. You could use a bash script for that


#!/bin/bash

# Define the default parameters
Device='iPad (gen 7) landscape'
Key='yourname:youremail@example.com'

# Function to perform the scan
scan() {
    node cli.js -c 2 -o "$1-a11y-scan-results.zip" -u "https://$1" -d "$Device" -k "$Key"
}

# Check for argument
if [ -z "$1" ]; then
    echo "Usage: $0 <site>"
    exit 1
fi

# Call the scan function with the provided argument
scan "$1"

Now, you can simply run ./scan.sh site1.com to perform the scan on site1.com with default parameters. Adjust the script according to your needs if you want to change default parameters or add more options.