Skip to content

Commit

Permalink
Bugfixed parameter mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
noccy80 committed Dec 15, 2016
1 parent 33e6204 commit 572b12e
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 16 deletions.
9 changes: 9 additions & 0 deletions bin/phpl-edit
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,16 @@ if (cmdl_get($opts,'list')) {
} elseif (cmdl_get($opts,'E')) {
passthru("editor ".escapeshellarg(PHPL_CONFIG));
if (RELOAD) passthru("phpl-reload --prompt");
exit;
} elseif (($theme = cmdl_get($opts,'theme'))) {
if ($theme == 'list') {
$themes = glob(PHPL_THEMES."/*.theme");
printf("Installed themes:\n");
foreach ($themes as $theme) {
printf(" - %s\n", basename($theme,".theme"));
}
exit(0);
}
if (!file_exists(PHPL_THEMES."/{$theme}.theme")) {
printf("Error: No such theme, %s\n", $theme);
exit(1);
Expand Down
12 changes: 7 additions & 5 deletions bin/phpl-reload
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,18 @@ function reload_prompt() {
continue;
}
$opts = $_MODULES[$item[1]]->opts;
$defs = [];
$type = [];
$defs = []; $type = []; $maps = [];
foreach ($opts as $opt) {
$defs[$opt->key] = $opt->def;
$type[$opt->key] = $opt->type;
$type[$opt->name] = $opt->type;
$maps[$opt->name] = $opt->key;
}
// Coerce types
$aout = [];
foreach ($attr as $k=>$v) {
if (array_key_exists($k,$type)) {
switch ($type[$k]) {
case 'bool':
case 'boolean':
$attr[$k] = (bool)$v;
break;
case 'int':
Expand All @@ -69,9 +70,10 @@ function reload_prompt() {
default:
QUIET or printf("Warning: Unknown option type %s", $type[$k]);
}
$aout[$maps[$k]] = $v;
}
}
$segments[] = sprintf("_%s(%s)", $item[1], var_export(array_merge($defs,$attr),true));
$segments[] = sprintf("_%s(%s)", $item[1], var_export(array_merge($defs,$aout),true));
}

$modsrc = [];
Expand Down
4 changes: 2 additions & 2 deletions modules/git.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
define("GIT_SHOW_STATUS", "show_status");

// Module
function _git(array $opts=[]) {
function _git(array $opts) {

$git = "env LANG=C git";

Expand All @@ -35,7 +35,7 @@ function _git(array $opts=[]) {
$marks[] = ICON_GIT_NEED_PULL_SYMBOL.$match[1];
}

if ($opts[GIT_SHOW_TAG]==true) {
if ($opts[GIT_SHOW_TAG]) {
$tag = exec("{$git} describe --tags 2>/dev/null");
if ($tag)
$marks[] = ICON_GIT_TAG.(strpos($tag,'-')?substr($tag,0,strpos($tag,'-')).'+':$tag);
Expand Down
14 changes: 5 additions & 9 deletions themes/default.theme
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ path {
background: cyan;
}

loadavg {
color: bright-yellow;
background: gray;
}

.vcs {
background: blue;
}
Expand All @@ -27,12 +32,3 @@ status.bad {
background: red;
}

loadavg {
color: bright-yellow;
background: gray;
}

text.test {
background: white;
color: black;
}
6 changes: 6 additions & 0 deletions themes/mono.theme
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* {
color: white;
background: none;
pad-before: 1;
pad-after: 1;
}
45 changes: 45 additions & 0 deletions themes/solarized.theme
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
$pragma(256color)

// Solarized color theme
$set(base03,#002b36)
$set(base02,#073642)
$set(base01,#586e75)
$set(base00,#657b83)
$set(base0,#839496)
$set(base1,#93a1a1)
$set(base2,#eee8d5)
$set(base3,#fdf6e3)
$set(yellow,#b58900)
$set(orange,#cb4b16)
$set(red,#dc322f)
$set(magenta,#d33682)
$set(violet,#6c71c4)
$set(blue,#268bd2)
$set(cyan,#2aa198)
$set(green,#859900)

* {
color: %base0;
background: %base03;
pad-before: 1;
pad-after: 1;
}

path {
color: %base1;
}

loadavg {
background: %base01;
color: %base2;
}

.vcs {
background: %base01;
color: %base1;
}

.sys {
background: %base02;
color: %base2
}

0 comments on commit 572b12e

Please sign in to comment.