Moved sub directories on source to top level

This allows for normal inclusion in OTP releases.
This commit is contained in:
Eric Merritt
2010-08-12 09:31:00 +08:00
committed by Juan Jose Comellas
parent 02eef09d89
commit ba7ae64d2a
4 changed files with 2 additions and 2 deletions
+46
View File
@@ -0,0 +1,46 @@
%%%-------------------------------------------------------------------
%%% @author Juan Jose Comellas <juanjo@comellas.org>
%%% @copyright (C) 2009 Juan Jose Comellas
%%% @doc Example file for the getopt module.
%%% @end
%%%
%%% This source file is subject to the New BSD License. You should have received
%%% a copy of the New BSD license with this software. If not, it can be
%%% retrieved from: http://www.opensource.org/licenses/bsd-license.php
%%%-------------------------------------------------------------------
-module(ex1).
-author('juanjo@comellas.org').
-export([test/0, test/1]).
test() ->
test("-U myuser -P mypassword --host myhost -x -o myfile.dump mydb dummy1").
test(CmdLine) ->
OptSpecList = option_spec_list(),
io:format("For command line: ~p~n"
"getopt:parse/2 returns:~n~n", [CmdLine]),
case getopt:parse(OptSpecList, CmdLine) of
{ok, {Options, NonOptArgs}} ->
io:format("Options:~n ~p~n~nNon-option arguments:~n ~p~n", [Options, NonOptArgs]);
{error, {Reason, Data}} ->
io:format("Error: ~s ~p~n~n", [Reason, Data]),
getopt:usage(OptSpecList, "ex1")
end.
option_spec_list() ->
CurrentUser = os:getenv("USER"),
[
%% {Name, ShortOpt, LongOpt, ArgSpec, HelpMsg}
{help, $?, "help", undefined, "Show the program options"},
{username, $U, "username", string, "Username to connect to the database"},
{password, $P, "password", {string, CurrentUser}, "Password to connect to the database"},
{host, $h, "host", {string, "localhost"}, "Database server host name or IP address"},
{port, $p, "port", {integer, 1000}, "Database server port"},
{output_file, $o, "output-file", string, "File where the data will be saved to"},
{xml, $x, "xml", undefined, "Output data as XML"},
{dbname, undefined, undefined, string, "Database name"}
].
+50
View File
@@ -0,0 +1,50 @@
%%%-------------------------------------------------------------------
%%% @author Juan Jose Comellas <juanjo@comellas.org>
%%% @copyright (C) 2009 Juan Jose Comellas
%%% @doc Example file for the getopt module.
%%% @end
%%%
%%% This source file is subject to the New BSD License. You should have received
%%% a copy of the New BSD license with this software. If not, it can be
%%% retrieved from: http://www.opensource.org/licenses/bsd-license.php
%%%-------------------------------------------------------------------
-module(rebar_test).
-author('juanjo@comellas.org').
-export([test/0, test/1, usage/0]).
test() ->
test("-f verbose=1 --quiet=on -j2 dummy1 dummy2").
test(CmdLine) ->
OptSpecList = option_spec_list(),
io:format("For command line: ~p~n"
"getopt:parse/2 returns:~n~n", [CmdLine]),
case getopt:parse(OptSpecList, CmdLine) of
{ok, {Options, NonOptArgs}} ->
io:format("Options:~n ~p~n~nNon-option arguments:~n ~p~n", [Options, NonOptArgs]);
{error, {Reason, Data}} ->
io:format("Error: ~s ~p~n~n", [Reason, Data]),
usage(OptSpecList)
end.
usage() ->
usage(option_spec_list()).
usage(OptSpecList) ->
getopt:usage(OptSpecList, "rebar_test", "[var1=val1 ...] [command1 ...]",
[{"var=value", "Variables that will affect the compilation (e.g. debug=1)"},
{"command", "Commands that will be executed by rebar (e.g. compile)"}]).
option_spec_list() ->
CpuCount = erlang:system_info(logical_processors),
[
%% {Name, ShortOpt, LongOpt, ArgSpec, HelpMsg}
{help, $h, "help", undefined, "Show the program options"},
{jobs, $j, "jobs", {integer, CpuCount}, "Number of concurrent jobs"},
{verbose, $v, "verbose", {boolean, false}, "Be verbose about what gets done"},
{force, $f, "force", {boolean, false}, "Force"}
].