summaryrefslogtreecommitdiff
path: root/doc/todo/shortcut_optional_parameters.mdwn
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-02-10 21:14:31 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-02-10 21:14:31 +0000
commit8648169e959b6975e5c4ef3eaa279717df320272 (patch)
tree1ab3cbfe967609caf886bff68252255f5c03db76 /doc/todo/shortcut_optional_parameters.mdwn
parent97622e5aa8e9fb938bce191d320a9b698e55902c (diff)
web commit by JoshTriplett: Optional parameters for shortcuts.
Diffstat (limited to 'doc/todo/shortcut_optional_parameters.mdwn')
-rw-r--r--doc/todo/shortcut_optional_parameters.mdwn24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/todo/shortcut_optional_parameters.mdwn b/doc/todo/shortcut_optional_parameters.mdwn
new file mode 100644
index 000000000..494aac98a
--- /dev/null
+++ b/doc/todo/shortcut_optional_parameters.mdwn
@@ -0,0 +1,24 @@
+Consider the "All files in this package search" on
+<http://packages.debian.org>. The URL for such a search looks like this:
+
+ http://packages.debian.org/cgi-bin/search_contents.pl?word=packagename&searchmode=filelist&case=insensitive&version=unstable&arch=i386
+
+To create a "debfiles" [[shortcut|shortcuts]] that takes a package name, you
+could just hardcode the architecture and distribution:
+
+ \[[shortcut name=debfiles url="http://packages.debian.org/cgi-bin/search_contents.pl?word=%s&searchmode=filelist&case=insensitive&version=unstable&arch=i386"]]
+ \[[debfiles ikiwiki]]
+
+But what if you could have them as optional parameters instead? The syntax
+for the invocation should look like this:
+
+ \[[debfiles ikiwiki dist=testing]]
+
+Some possible syntax choices for the shortcut definition:
+
+ \[[shortcut name=debfiles url="http://packages.debian.org/cgi-bin/search_contents.pl?word=%s&searchmode=filelist&case=insensitive&version=%(dist)s&arch=%(arch)s" dist="unstable" arch="i386"]]
+ \[[shortcut name=debfiles url="http://packages.debian.org/cgi-bin/search_contents.pl?word=%s&searchmode=filelist&case=insensitive&version=%(dist=unstable)s&arch=%(arch=i386)s"]]
+ \[[shortcut name=debfiles url="http://packages.debian.org/cgi-bin/search_contents.pl?word=%s&searchmode=filelist&case=insensitive&version=%{dist=unstable}&arch=%{arch=i386}"]]
+ \[[shortcut name=debfiles url="http://packages.debian.org/cgi-bin/search_contents.pl?word=$*&searchmode=filelist&case=insensitive&version=${dist=unstable}&arch=${arch=i386}"]]
+
+--[[JoshTriplett]]