-
Notifications
You must be signed in to change notification settings - Fork 269
Expand file tree
/
Copy pathParseVboxLang.php
More file actions
83 lines (73 loc) · 2.31 KB
/
Copy pathParseVboxLang.php
File metadata and controls
83 lines (73 loc) · 2.31 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* Parse VirtualBox (Qt) language files
*
* @author Ian Moore <imooreyahoo@gmail.com>
* @copyright 2010-2015 Ian Moore
* @license https://github.com/phpvirtualbox/phpvirtualbox/blob/master/LICENSE.txt GPLv3
* @link https://github.com/phpvirtualbox/phpvirtualbox
*/
require_once 'ParseVboxLang.inc';
// Get command line options.
$o = getopt(ParseVboxLang::$shortopts, ParseVboxLang::$longopts);
if (isset($o['infile']) === true) {
$infile = $o['infile'];
} else if (isset($o['i']) === true) {
$infile = $o['i'];
}
if (isset($o['outfile']) === true) {
$outfile = $o['outfile'];
} else if (isset($o['o']) === true) {
$outfile = $o['o'];
}
if (isset($o['indir']) === true) {
$indir = $o['indir'];
} else if (isset($o['I']) === true) {
$indir = $o['I'];
}
if (isset($o['outdir']) === true) {
$outdir = $o['outdir'];
} else if (isset($o['O']) === true) {
$outdir = $o['O'];
}
// File input.
if (isset($infile) === true) {
if (isset($o['print']) === true || isset($o['p']) === true) {
ParseVboxLang::printJson($infile);
} else if (isset($o['info']) === true || isset($o['n']) === true) {
ParseVboxLang::printFileInfo($infile);
} else if (isset($outfile) === true) {
if (isset($o['force']) === true || isset($o['F']) === true) {
$force = true;
} else {
$force = false;
}
if (isset($o['verbose']) === true || isset($o['V']) === true) {
$verbose = true;
} else {
$verbose = false;
}
ParseVboxLang::convertFile($infile, $outfile, $force, $verbose);
} else {
ParseVboxLang::printUsage($argv);
}//end if
}//end if
// Directory input.
if (isset($indir) === true) {
if (isset($outdir) === true) {
if (isset($o['force']) === true || isset($o['F']) === true) {
$force = true;
} else {
$force = false;
}
ParseVboxLang::convertFiles($indir, $outdir, $force);
} else if (isset($o['info']) === true || isset($o['n']) === true) {
ParseVboxLang::printFilesInfo($indir);
} else {
ParseVboxLang::printUsage($argv);
}
}
// Help input, no input or wrong input.
if (empty($o) === true || isset($o['help']) === true || isset($o['h']) === true) {
ParseVboxLang::printUsage($argv);
}