aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-04-20 13:07:04 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-04-20 13:07:04 +0530
commite1d8adce2f910caf3009e2a35032e76de73ba852 (patch)
treec7d554bc04471b638022e4dd4d9cb257abc0c25f
parentd5107d28ac41201e764a168c43f2931b6d44854c (diff)
downloadnnn-e1d8adce2f910caf3009e2a35032e76de73ba852.tar.gz
Plugin ipinfo: fetch IP address and whois info
-rw-r--r--plugins/README.md3
-rwxr-xr-xplugins/ipinfo13
2 files changed, 16 insertions, 0 deletions
diff --git a/plugins/README.md b/plugins/README.md
index f9a8fa2..0fa28dd 100644
--- a/plugins/README.md
+++ b/plugins/README.md
@@ -6,6 +6,7 @@
| hexview | sh | xxd, `$PAGER` | View a file in hex |
| imgresize | sh | [imgp](https://github.com/jarun/imgp) | Resize images in directory to screen resolution |
| imgur | bash | - | Upload an image to imgur (from [imgur-screenshot](https://github.com/jomo/imgur-screenshot)) |
+| ipinfo | sh | curl, whois | Fetch IP address and whois information |
| kdeconnect | sh | kdeconnect-cli | Send selected files to an Android device |
| ndiff | sh | vimdiff | File and directory diff for selection |
| nmount | sh | pmount | Toggle mount status of a device as normal user |
@@ -24,6 +25,8 @@ Plugins can access:
- the currently highlighted file (the file name is passed as the argument to a plugin)
- the current selection (by reading the file .nnncp, see the plugin `ndiff`)
+Each script has a _Description_ section which provides more details on what the script does, if applicable.
+
#### Contributing plugins
Plugins are scripts and all scripting languages should work. However, POSIX-compliant shell scripts runnable in `sh` are preferred. If that's too rudimentary for your use case, use Python, Perl or Ruby. Please keep non-portable commands (like `notify-send`) commented so users from any other OS/DE aren't surprised.
diff --git a/plugins/ipinfo b/plugins/ipinfo
new file mode 100755
index 0000000..9ee1ca9
--- /dev/null
+++ b/plugins/ipinfo
@@ -0,0 +1,13 @@
+#!/usr/bin/env sh
+
+# Description: Shows the IP address and whois information.
+#
+# Shell: POSIX compliant
+# Author: Arun Prakash Jana
+
+IP=`curl -s ifconfig.me`
+
+whois "$IP"
+echo your IP address is "$IP"
+
+read dummy