Command line tool to duplicate/modify version number strings across source code and distribution files according to syntax context.

⌈⌋ branch:  version numbers get/write


Check-in [ea215399f1]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1 Hash:ea215399f110982b907475e16f43cdbfb6e79066
Date: 2014-02-10 00:51:38
User: mario
Comment:Reintroduce --help as command, Allow symlinks on version script (set_version, write_version, show_version) to define a default action.
Tags And Properties
  • bgcolor=#c0ffc0 added by [b6a86dfbbe] on 2014-03-19 17:31:48
  • branch=trunk inherited from [febbd3fd5d]
  • sym-stable added by [b6a86dfbbe] on 2014-03-19 17:31:48
  • sym-trunk inherited from [febbd3fd5d]
Context
2014-02-10
00:51
[ea215399f1] Leaf: Reintroduce --help as command, Allow symlinks on version script (set_version, write_version, show_version) to define a default action. (user: mario, tags: trunk, stable)
00:36
[a9910f4ee2] Escape shell arg for ar|tar .deb reading (user: mario, tags: trunk)
Changes

Changes to version.php.

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
...
178
179
180
181
182
183
184

185
186
187
188
189
190
191





192
193
194
195
196
197
198
199
200
201
...
301
302
303
304
305
306
307





308
309
310
311
312
313
314
        "get" => "get",  "from" => "get",
        "read" => "read",  "fetch" => "read",
        "show" => "show",  "echo" => "show",  "print" => "show",
        "increment" => "increment",  "++" => "increment",  "add" => "increment",  "inc" => "increment",  "incr" => "increment",
        "bump" => "bump",  "suffix" => "bump",  "release" => "bump",
        "format" => "format",  "fmt" => "format",   "and" => "format",  "then" => "format",  "set" => "format",
        "last" => "last",  "lastfn" => "last",
       #"help" => "help",
        "dry" => "dry",  "nowrite" => "dry",  "dryrun" => "dry",
    );

}//cfg



................................................................................
$last = new command();





#-- Init argument list

$argv = array_slice($_SERVER["argv"], 1);

// no args = help
if (empty($argv)) {
    action::help();
}






// just one filename arg = default action to 'get'
elseif (count($argv) == 1) {
    $cmd->action = "get";  //@todo: get_ or set_ from argv[0] basename?
}





#-- Iterate over argument list
................................................................................
            break;

        // NOP
        case "":
        case "format":
            // do nothing (--format:TYPE:N params can be attached to any other command, --format itself incurs no action)
            break;






        // Should've been catched earlier (= an assert() would do here)            
        default:
            error("Unimplemented action '$cmd->action'\n", 24 /*EINVAL*/);
    }
}








|







 







>




|


>
>
>
>
>
|

|







 







>
>
>
>
>







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
...
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
...
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
        "get" => "get",  "from" => "get",
        "read" => "read",  "fetch" => "read",
        "show" => "show",  "echo" => "show",  "print" => "show",
        "increment" => "increment",  "++" => "increment",  "add" => "increment",  "inc" => "increment",  "incr" => "increment",
        "bump" => "bump",  "suffix" => "bump",  "release" => "bump",
        "format" => "format",  "fmt" => "format",   "and" => "format",  "then" => "format",  "set" => "format",
        "last" => "last",  "lastfn" => "last",
        "help" => "help",
        "dry" => "dry",  "nowrite" => "dry",  "dryrun" => "dry",
    );

}//cfg



................................................................................
$last = new command();





#-- Init argument list
$argv0 = basename($_SERVER["argv"][0]);
$argv = array_slice($_SERVER["argv"], 1);

// no args = help
if (empty($argv)) {
    $argv[] = "help";
}

// Use get_ or write_ prefix from invocation basename as first action
elseif (strpos($argv0, "_")) {
    $cmd->action = key(array_intersect_key(array_flip(explode("_", $argv0)), cfg::$action_aliases));
}

// Just one filename arg = use default action 'get'
elseif (count($argv) == 1) {
    $cmd->action = "get";
}





#-- Iterate over argument list
................................................................................
            break;

        // NOP
        case "":
        case "format":
            // do nothing (--format:TYPE:N params can be attached to any other command, --format itself incurs no action)
            break;

        // Show top level documentation as help
        case "help":
            action::help();
            break;

        // Should've been catched earlier (= an assert() would do here)            
        default:
            error("Unimplemented action '$cmd->action'\n", 24 /*EINVAL*/);
    }
}