diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2011-12-10 01:45:03 -0200 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2011-12-10 01:45:03 -0200 |
| commit | bb0c49c9f14f69cdbae3558e10f271dfbda6d182 (patch) | |
| tree | a49cceb783acd2795c5ae1b8ec84f718ad7a00cf /src | |
| parent | e74f312e318868dcb931aa5b6c911af0ab830abc (diff) | |
| download | luarocks-bb0c49c9f14f69cdbae3558e10f271dfbda6d182.tar.gz luarocks-bb0c49c9f14f69cdbae3558e10f271dfbda6d182.tar.bz2 luarocks-bb0c49c9f14f69cdbae3558e10f271dfbda6d182.zip | |
Use better names for command-line flags. Keep old ones around for compatibility.
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/add.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/admin_remove.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/command_line.lua | 34 | ||||
| -rw-r--r-- | src/luarocks/help.lua | 14 | ||||
| -rw-r--r-- | src/luarocks/refresh_cache.lua | 2 |
5 files changed, 31 insertions, 23 deletions
diff --git a/src/luarocks/add.lua b/src/luarocks/add.lua index 6edfea35..9a729ada 100644 --- a/src/luarocks/add.lua +++ b/src/luarocks/add.lua | |||
| @@ -101,7 +101,7 @@ function run(...) | |||
| 101 | if #files < 1 then | 101 | if #files < 1 then |
| 102 | return nil, "Argument missing, see help." | 102 | return nil, "Argument missing, see help." |
| 103 | end | 103 | end |
| 104 | local server, server_table = cache.get_upload_server(flags["to"]) | 104 | local server, server_table = cache.get_upload_server(flags["tree"]) |
| 105 | if not server then return nil, server_table end | 105 | if not server then return nil, server_table end |
| 106 | return add_files_to_server(not flags["no-refresh"], files, server, server_table) | 106 | return add_files_to_server(not flags["no-refresh"], files, server, server_table) |
| 107 | end | 107 | end |
diff --git a/src/luarocks/admin_remove.lua b/src/luarocks/admin_remove.lua index 1b897e7d..f1268576 100644 --- a/src/luarocks/admin_remove.lua +++ b/src/luarocks/admin_remove.lua | |||
| @@ -80,7 +80,7 @@ function run(...) | |||
| 80 | if #files < 1 then | 80 | if #files < 1 then |
| 81 | return nil, "Argument missing, see help." | 81 | return nil, "Argument missing, see help." |
| 82 | end | 82 | end |
| 83 | local server, server_table = cache.get_upload_server(flags["from"]) | 83 | local server, server_table = cache.get_upload_server(flags["server"]) |
| 84 | if not server then return nil, server_table end | 84 | if not server then return nil, server_table end |
| 85 | return remove_files_from_server(not flags["no-refresh"], files, server, server_table) | 85 | return remove_files_from_server(not flags["no-refresh"], files, server, server_table) |
| 86 | end | 86 | end |
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index 41c1c278..8fa9073c 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
| @@ -57,6 +57,12 @@ function run_command(...) | |||
| 57 | end | 57 | end |
| 58 | local nonflags = { util.parse_flags(unpack(args)) } | 58 | local nonflags = { util.parse_flags(unpack(args)) } |
| 59 | local flags = table.remove(nonflags, 1) | 59 | local flags = table.remove(nonflags, 1) |
| 60 | |||
| 61 | if flags["from"] then flags["server"] = flags["from"] end | ||
| 62 | if flags["only-from"] then flags["only-server"] = flags["only-from"] end | ||
| 63 | if flags["only-sources-from"] then flags["only-sources"] = flags["only-sources-from"] end | ||
| 64 | if flags["to"] then flags["tree"] = flags["to"] end | ||
| 65 | |||
| 60 | cfg.flags = flags | 66 | cfg.flags = flags |
| 61 | 67 | ||
| 62 | local command | 68 | local command |
| @@ -90,11 +96,11 @@ function run_command(...) | |||
| 90 | flags["local"] = true | 96 | flags["local"] = true |
| 91 | end | 97 | end |
| 92 | 98 | ||
| 93 | if flags["to"] then | 99 | if flags["tree"] then |
| 94 | if flags["to"] == true then | 100 | if flags["tree"] == true then |
| 95 | die("Argument error: use --to=<path>") | 101 | die("Argument error: use --tree=<path>") |
| 96 | end | 102 | end |
| 97 | local root_dir = fs.absolute_name(flags["to"]) | 103 | local root_dir = fs.absolute_name(flags["tree"]) |
| 98 | path.use_tree(root_dir) | 104 | path.use_tree(root_dir) |
| 99 | elseif flags["local"] then | 105 | elseif flags["local"] then |
| 100 | path.use_tree(cfg.home_tree) | 106 | path.use_tree(cfg.home_tree) |
| @@ -116,23 +122,23 @@ function run_command(...) | |||
| 116 | cfg.variables.ROCKS_TREE = cfg.rocks_dir | 122 | cfg.variables.ROCKS_TREE = cfg.rocks_dir |
| 117 | cfg.variables.SCRIPTS_DIR = cfg.deploy_bin_dir | 123 | cfg.variables.SCRIPTS_DIR = cfg.deploy_bin_dir |
| 118 | 124 | ||
| 119 | if flags["from"] then | 125 | if flags["server"] then |
| 120 | if flags["from"] == true then | 126 | if flags["server"] == true then |
| 121 | die("Argument error: use --from=<url>") | 127 | die("Argument error: use --server=<url>") |
| 122 | end | 128 | end |
| 123 | local protocol, path = dir.split_url(flags["from"]) | 129 | local protocol, path = dir.split_url(flags["server"]) |
| 124 | table.insert(cfg.rocks_servers, 1, protocol.."://"..path) | 130 | table.insert(cfg.rocks_servers, 1, protocol.."://"..path) |
| 125 | end | 131 | end |
| 126 | 132 | ||
| 127 | if flags["only-from"] then | 133 | if flags["only-server"] then |
| 128 | if flags["only-from"] == true then | 134 | if flags["only-server"] == true then |
| 129 | die("Argument error: use --only-from=<url>") | 135 | die("Argument error: use --only-server=<url>") |
| 130 | end | 136 | end |
| 131 | cfg.rocks_servers = { flags["only-from"] } | 137 | cfg.rocks_servers = { flags["only-server"] } |
| 132 | end | 138 | end |
| 133 | 139 | ||
| 134 | if flags["only-sources-from"] then | 140 | if flags["only-sources"] then |
| 135 | cfg.only_sources_from = flags["only-sources-from"] | 141 | cfg.only_sources_from = flags["only-sources"] |
| 136 | end | 142 | end |
| 137 | 143 | ||
| 138 | if command ~= "help" then | 144 | if command ~= "help" then |
diff --git a/src/luarocks/help.lua b/src/luarocks/help.lua index a2e64b5d..718580ce 100644 --- a/src/luarocks/help.lua +++ b/src/luarocks/help.lua | |||
| @@ -35,12 +35,14 @@ usage: ]]..program_name..[[ [--from=<server> | --only-from=<server>] [--to=<tree | |||
| 35 | Variables from the "variables" table of the configuration file | 35 | Variables from the "variables" table of the configuration file |
| 36 | can be overriden with VAR=VALUE assignments. | 36 | can be overriden with VAR=VALUE assignments. |
| 37 | 37 | ||
| 38 | --from=<server> Fetch rocks/rockspecs from this server | 38 | --server=<server> Fetch rocks/rockspecs from this server |
| 39 | (takes priority over config file) | 39 | (takes priority over config file) |
| 40 | --only-from=<server> Fetch rocks/rockspecs from this server only | 40 | --only-server=<server> Fetch rocks/rockspecs from this server only |
| 41 | (overrides any entries in the config file) | 41 | (overrides any entries in the config file) |
| 42 | --to=<tree> Which tree to operate on. | 42 | --only-sources=<url> Restrict downloads to paths matching the |
| 43 | --local Use the tree in the user's home directory. | 43 | given URL. |
| 44 | --tree=<tree> Which tree to operate on. | ||
| 45 | --local Use the tree in the user's home directory. | ||
| 44 | 46 | ||
| 45 | Supported commands: | 47 | Supported commands: |
| 46 | ]]) | 48 | ]]) |
diff --git a/src/luarocks/refresh_cache.lua b/src/luarocks/refresh_cache.lua index 23f86a13..2ea7e9f4 100644 --- a/src/luarocks/refresh_cache.lua +++ b/src/luarocks/refresh_cache.lua | |||
| @@ -15,7 +15,7 @@ from the configuration file is used instead. | |||
| 15 | 15 | ||
| 16 | function run(...) | 16 | function run(...) |
| 17 | local flags = util.parse_flags(...) | 17 | local flags = util.parse_flags(...) |
| 18 | local server, upload_server = cache.get_upload_server(flags["from"]) | 18 | local server, upload_server = cache.get_upload_server(flags["server"]) |
| 19 | if not server then return nil, upload_server end | 19 | if not server then return nil, upload_server end |
| 20 | local download_url = cache.get_server_urls(server, upload_server) | 20 | local download_url = cache.get_server_urls(server, upload_server) |
| 21 | 21 | ||
