-
Notifications
You must be signed in to change notification settings - Fork 5
/
args.inc
executable file
·66 lines (59 loc) · 1.13 KB
/
args.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/php
<?php
#-------------------------------------------------------------------
# These are library methods for handling command line arguments
# in the main application.
#
# The command line should look like these examples:
#
# crud about
# crud gen controller ClassName action
# crud gen model ClassName
# crud gen scaffold ClassName
#-------------------------------------------------------------------
function usage()
{
echo "Usage statement here\n";
}
function do_gen_controller(&$args)
{
echo "CONTROLLER\n";
print_r($args);
}
function do_gen_model(&$args)
{
echo "MODEL\n";
print_r($args);
}
function do_gen_view(&$args)
{
echo "VIEW\n";
print_r($args);
}
function do_gen_action(&$args)
{
print_r($args);
# better be at least 4 args or we've got a problem
$n = count($args);
if ($n < 4)
{
echo "DUDE, n was < 4\n";
usage();
exit;
}
# third arg is what user wants to generate
$gen = $args[2];
if ($gen == 'controller')
{
do_gen_controller($args);
}
elseif ($gen == 'model')
{
do_gen_model($args);
}
elseif ($gen == 'view')
{
do_gen_view($args);
}
}
?>