The Sysadmin Wiki
Advertisement

This page should present you the Ubiquity command, if you have the extension installed and you don't have the command already.

Source code[]

The code is saved in a .js file on this wiki. For security reasons, the .js files on the wiki are only editable by users with sysop access.

CmdUtils.CreateCommand({
	names: ["ubuntu-package", "upk"],
	locale: "en-US",
	arguments: [ {role: "object", nountype: noun_arb_text, label: "search term"}],
	license: "MPL, GPLv2+, GFDL, LGPLv2+",
	icon: "http://packages.ubuntu.com/favicon.ico",
	preview: function(pblock, directObject) {
		var searchText = jQuery.trim(directObject.text);
		var searchDesc = "Searches Ubuntu packages";
		if(searchText.length < 1) {
			pblock.innerHTML = searchDesc;
			return;
		}
		var previewTemplate = searchDesc+" for ${query}";
		var previewData = {query: searchText};
		pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData);
	},
	execute: function(args) {
		var url = "http://packages.ubuntu.com/search?keywords={QUERY}"
		var urlString = url.replace("{QUERY}", args.object.text);
		Utils.openUrlInBrowser(urlString);
	}
});


TODO: Preview the results (See: Todo list)
Advertisement