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
Comment:Reintroduce --help as command, Allow symlinks on version script (set_version, write_version, show_version) to define a default action.
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA1: ea215399f110982b907475e16f43cdbfb6e79066
User & Date: mario 2014-02-10 00:51:38
Context
2020-10-31
21:18
Add `static` to class functions (php8), revert to \r\n in place of \R for older libpcre versions. Leaf check-in: b62946f7b1 user: mario tags: trunk
2014-02-10
00:51
Reintroduce --help as command, Allow symlinks on version script (set_version, write_version, show_version) to define a default action. check-in: ea215399f1 user: mario tags: trunk, stable
00:36
Escape shell arg for ar|tar .deb reading check-in: a9910f4ee2 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to version.php.

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
        "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










|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
        "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



178
179
180
181
182
183
184

185
186
187
188


189



190
191
192
193
194
195
196
197
198
199
200
201
$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







>




>
>
|
>
>
>


|

|







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
$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
301
302
303
304
305
306
307





308
309
310
311
312
313
314
            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*/);
    }
}








>
>
>
>
>







307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
            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*/);
    }
}