summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSigrid <ftrvxmtrx@gmail.com>2021-03-02 08:21:56 +0100
committerSigrid <ftrvxmtrx@gmail.com>2021-03-02 08:21:56 +0100
commit2aba7615afdabfdef8e02d162ffee2ecdf3e39e9 (patch)
tree1184800b0357bf0f361d18113599ac6c85865c75
parentf234b29c7fc119fa148af2108f93e5eaf9ecbfb4 (diff)
downloadplan9front-2aba7615afdabfdef8e02d162ffee2ecdf3e39e9.tar.xz
mothra: add "d" command to search for a text on the internet (using duckduckgo)
-rwxr-xr-xsys/man/1/mothra5
-rw-r--r--sys/src/cmd/mothra/mothra.c10
2 files changed, 15 insertions, 0 deletions
diff --git a/sys/man/1/mothra b/sys/man/1/mothra
index bee49830c..364c9dfc8 100755
--- a/sys/man/1/mothra
+++ b/sys/man/1/mothra
@@ -132,6 +132,11 @@ The typed commands are:
.B a
Toggle alt display.
.TP
+.BI d " text
+Search for the given
+.I text
+on the internet.
+.TP
.BI g " url
Go to the page with the given URL.
.TP
diff --git a/sys/src/cmd/mothra/mothra.c b/sys/src/cmd/mothra/mothra.c
index 84d3fbced..09a50329c 100644
--- a/sys/src/cmd/mothra/mothra.c
+++ b/sys/src/cmd/mothra/mothra.c
@@ -675,6 +675,16 @@ void docmd(Panel *p, char *s){
if(*s=='\0' && selection)
hit3(3, 0);
break;
+ case 'd':
+ s = arg(s);
+ if(*s){
+ s = smprint("https://duckduckgo.com/html/?q=%U", s);
+ if(s != nil)
+ geturl(s, -1, 0, 0);
+ free(s);
+ }else
+ message("Usage: d text");
+ break;
case 'g':
s = arg(s);
if(*s=='\0'){