Created
July 6, 2014 09:24
-
-
Save cahna/95d4a7cba13ee1fa898f to your computer and use it in GitHub Desktop.
Revisions
-
cahna created this gist
Jul 6, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ -- Package that helper into the worlds shortest module. -- Usage: import HOME, SHELL, EDITOR from require 'ENV' setmetatable {}, __index: (k) => os.getenv k This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ -- Nifty shorthand for creating local variables from environment variables in moonscript using metatables import HOME, SHELL, EDITOR from setmetatable {}, __index: (k) => os.getenv k -- are both equivalent to: HOME = os.getenv "HOME" SHELL = os.getenv "SHELL" EDITOR = os.getenv "EDITOR" This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ import HOME, SHELL, EDITOR from require 'ENV'