Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/sys.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Farabet <clement.farabet@gmail.com>2013-07-04 22:04:33 +0400
committerClement Farabet <clement.farabet@gmail.com>2013-07-04 22:04:33 +0400
commit4db829f4a8b4f198075591115c85ea4d97254200 (patch)
tree6d846325c06f15e3e5a3f2d30db1e03fe0dbae65
parentcc799962aebe303ef02cd3a971efb989e6f4a70f (diff)
parent0fbff5e41a3c42688208bb42adb56d7d8af8ad52 (diff)
tMerge branch 'master' of github.com:clementfarabet/lua---sys
-rw-r--r--README.md48
-rw-r--r--README.txt30
-rw-r--r--init.lua10
3 files changed, 53 insertions, 35 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a0b6aa8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,48 @@
+# Lua *system* package
+
+## Dependencies
+Torch7 (www.torch.ch)
+
+## Install
+```
+$ luarocks install sys
+```
+
+## Use
+```
+$ torch
+> require 'sys'
+> for k in pairs(sys) print(k) end -- gives you all the included functions
+dirname
+dirp
+usleep
+ls
+prefix
+uname
+pwd
+fstat
+COLORS
+lla
+tic
+toc
+OS
+la
+execute
+ll
+concat
+basename
+clock
+filep
+```
+
+### sys.COLORS
+If you'd like print in colours, follow the following snippets of code. Let start by listing the available colours
+```
+$ torch
+> for k in pairs(sys.COLORS) do print(k) end
+```
+Then, we can generate a shortcut `c = sys.COLORS` and use it within a `print`
+```
+> c = sys.COLORS
+> print(c.magenta .. 'This ' .. c.red .. 'is ' .. c.yellow .. 'a ' .. c.green .. 'rainbow' .. c.cyan .. '!')
+```
diff --git a/README.txt b/README.txt
deleted file mode 100644
index 93ef38c..0000000
--- a/README.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-DEPENDENCIES:
-Torch7 (www.torch.ch)
-
-INSTALL:
-$ torch-pkg install sys
-
-USE:
-$ torch
-> require 'sys'
-> for k in pairs(sys) print(k) end -- gives you all the included functions
-dirname
-dirp
-usleep
-ls
-prefix
-uname
-pwd
-fstat
-COLORS
-lla
-tic
-toc
-OS
-la
-execute
-ll
-concat
-basename
-clock
-filep
diff --git a/init.lua b/init.lua
index ab6d820..a615df5 100644
--- a/init.lua
+++ b/init.lua
@@ -117,10 +117,10 @@ OS = uname()
--------------------------------------------------------------------------------
-- ls (list dir)
--------------------------------------------------------------------------------
-ls = function() return execute 'ls' end
-ll = function() return execute 'ls -l' end
-la = function() return execute 'ls -a' end
-lla = function() return execute 'ls -la' end
+ls = function(d) d = d or ' ' return execute('ls ' ..d) end
+ll = function(d) d = d or ' ' return execute('ls -l ' ..d) end
+la = function(d) d = d or ' ' return execute('ls -a ' ..d) end
+lla = function(d) d = d or ' ' return execute('ls -la '..d) end
--------------------------------------------------------------------------------
-- prefix
@@ -244,4 +244,4 @@ else
_magenta = '\27[45m',
_cyan = '\27[46m',
_white = '\27[47m'}
-end \ No newline at end of file
+end