summaryrefslogtreecommitdiff
path: root/int.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-06-06 19:32:12 -0700
committerJeff Carr <[email protected]>2019-06-06 19:32:12 -0700
commit758e7d157b0a6191f83a5756d561a62a8142010f (patch)
treeeef6f0f740b3522d09fa8fd3970029fa5db35720 /int.go
parentd86e39f9ed71d444a37e3a47b87a8b5fd5e7770a (diff)
more shortcut commands
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'int.go')
-rw-r--r--int.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/int.go b/int.go
new file mode 100644
index 0000000..45186c7
--- /dev/null
+++ b/int.go
@@ -0,0 +1,21 @@
+package shell
+
+/*
+ send it anything, always get back an int
+*/
+
+// import "log"
+// import "reflect"
+// import "strings"
+// import "bytes"
+import "strconv"
+
+func Int(s string) int {
+ s = Chomp(s)
+ i, err := strconv.Atoi(s)
+ if (err != nil) {
+ handleError(err, -1)
+ return 0
+ }
+ return i
+}