NOTE: DuckDuckHack is in maintenance mode and DuckPAN development setup is not guaranteed to continue working.
DuckPAN is a command line interface to help developers build, test, and configure their Instant Answers.
Prints out the DuckPAN man page
If you encounter errors running duckpan, it's often worth first trying to update your environment:
update command will update to the latest version of the duckpan tool:
upgrade command will update both the duckpan tool and the DDG package:
This will lead you through a dialogue and generate the minimum necessary files with proper naming conventions. This command will only work inside a Goodie or Spice repository, and generate the corresponding Instant Answer.
duckpan new command has several preset file templates you can choose from. To choose a particular preset template:
duckpan new --template TEMPLATE_NAME
The word 'template' in this context refers to file configurations, not frontend HTML templates or template groups. The terminology is admittedly confusing.
In the Goodie repository, your options for
default - creates the basic file types you might need in your Goodie: a Perl file and a test file, both in their correct directories.
cheatsheet - creates the single necessary JSON file for a cheatsheet in the correct directory. For more information see the cheat sheets reference.
In the Spice repository, your options for
You'll also be prompted to add additional template files if you so please. This allows you to selectively add particular boilerplate file types:
Depending on your Instant Answer type, you will also be prompted to choose a handle function handler. This will help generate the right boilerplate for your handle function, and can always be edited later:
1> remainder: (default) The query without the trigger words, spacing and case are preserved.2> query_raw: Like remainder but with trigger words intact3> query: Full query normalized with a single space between terms4> query_lc: Like query but in lowercase5> query_clean: Like query_lc but with non-alphanumeric characters removed6> query_nowhitespace: All whitespace removed7> query_nowhitespace_nodash: All whitespace and hyphens removed8> matches: Returns an array of captured expression from a regular expression trigger9> words: Like query_clean but returns an array of the terms split on whitespace10> query_parts: Like query but returns an array of the terms split on whitespace11> query_raw_parts: Like query_parts but array contains original whitespace elementsWhich handler would you like to use to process the query? :
DuckPAN's configurability is rather new, and we look forward to add more templates and configurations in the future. We'd love to hear your thoughts and ideas for how to make this feature more useful to you!
Test Goodie and Spice triggers interactively on the command line. Typing a query here is just like using DuckDuckGo.com, except you're only viewing the server response, and in its raw form. Learn more about interactive testing.
duckpan server [--verbose] [--no-cache] [--port <number>]
Test Goodie and Spice Instant Answers on a local web server (for design/layout purposes)
--verbose to provide more details
--no-cache to prevent DuckPAN's cache from being used (this forces the requested files to be pushed into the cache)
--port to specify which port DuckPAN's server should run on (defaults to 5000)
View env commands and also shows the env variables currently stored in ~/.duckpan/env.ini
duckpan env <name> <value>
Add an environment variable that duckpan will remember. Useful for spice API keys. Variables are stored in ~/.duckpan/env.ini
duckpan env <name>
Retrieve the matching key for a given env variable.
duckpan env rm <name>
Remove an environment variable from duckpan
Release the project of the current directory to DuckPAN
Install all requirements of the specific DuckDuckHack project (if possible), like zeroclickinfo-spice, zeroclickinfo-goodie, duckduckgo or community-platform
installdeps, but avoids testing anything. Useful for speed, but not recommended unless you know what you are doing.
Check if you fulfill all requirements for the development environment (this is run automatically during setup)
Force installation of the latest released versions of DuckPAN and DDG