From 59ea7003b5e7bcd58b247146860f7972a92f186c Mon Sep 17 00:00:00 2001 From: Alfredo Canziani Date: Thu, 11 Apr 2013 13:20:34 -0400 Subject: Added operand to ls-based function --- init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 -- cgit v1.2.3 From 44e819ac4d3f7a09216d0d4dce42aea51a456f97 Mon Sep 17 00:00:00 2001 From: Alfredo Canziani Date: Tue, 28 May 2013 12:20:38 -0400 Subject: Changed the README from to --- README.md | 30 ++++++++++++++++++++++++++++++ README.txt | 30 ------------------------------ 2 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 README.md delete mode 100644 README.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..93ef38c --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +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/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 -- cgit v1.2.3 From 06c291b34a1838f01ffc685c457fec529ed60532 Mon Sep 17 00:00:00 2001 From: Alfredo Canziani Date: Tue, 28 May 2013 13:32:06 -0300 Subject: Update README.md Converted README from to Reformatted the documentation Added instruction about *how* to use --- README.md | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 93ef38c..a0b6aa8 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,15 @@ -DEPENDENCIES: +# Lua *system* package + +## Dependencies Torch7 (www.torch.ch) -INSTALL: -$ torch-pkg install sys +## Install +``` +$ luarocks install sys +``` -USE: +## Use +``` $ torch > require 'sys' > for k in pairs(sys) print(k) end -- gives you all the included functions @@ -28,3 +33,16 @@ 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 .. '!') +``` -- cgit v1.2.3