Skip to content

Commit

Permalink
up: update some for jump commands
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jul 24, 2022
1 parent cf00393 commit 8495032
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# docker build . -t inhere:kite
# run:
# docker run inhere:kite gh cl -h
FROM php:8.0-alpine
FROM php:8.1
ENV KITE_CMD="list"

WORKDIR /appdir
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ up-dev-deps: ## Update kite composer.lock and all depends on vendor
phar: ## build kite application to phar package
php -d phar.readonly=0 bin/kite phar:pack -o kite.phar

micro-bin:phar ## build kite application to phar package
cat ~/Workspace/php/phpsrc/php-src/sapi/micro/micro.sfx kite.phar > kiteapp

cs-fix: ## Fix code style for all files
gofmt -w ./

Expand Down
3 changes: 3 additions & 0 deletions app/Console/Attach/Golang/GenerateStructCmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use function array_filter;
use function array_merge;
use function get_class;
use function println;
use function str_replace;

/**
Expand Down Expand Up @@ -104,6 +105,8 @@ protected function execute(Input $input, Output $output): void
case 'yaml':
$data = ConfigUtil::parseYamlString($source);
$p->setText(Json::pretty($data));
$output->colored('JSON from YAML:');
println($p->getText());
$itemParser = new Json5ItemParser;
$itemParser->setKeyField('name');
break;
Expand Down
1 change: 1 addition & 0 deletions app/Console/Controller/JumpController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ protected static function commandAliases(): array
'hint' => ['match', 'search'],
'chdir' => ['into'],
'get' => ['cd'],
'list' => ['ls'],
];
}

Expand Down
6 changes: 3 additions & 3 deletions app/Lib/Jump/JumpStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ public function dumpTo(string $datafile = '', bool $force = false): void
*/
public function matchOne(string $keywords): string
{
if (!$keywords || '.' === $keywords) {
if ('.' === $keywords) {
return OS::getWorkDir();
}

// latestPath
if ($keywords === '-') {
// jump to prev path
if (!$keywords || $keywords === '-') {
return $this->prevPath;
}

Expand Down
2 changes: 1 addition & 1 deletion app/Lib/Parser/Item/FieldItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class FieldItem extends AbstractObj implements JsonSerializable
/**
* @var string
*/
public string $type = '';
public string $type = 'string';

/**
* sub-elem type on type is array
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"ext-mbstring": "*",
"inhere/console": "dev-master",
"inhere/sroute": "dev-master",
"inhere/php-validate": "dev-master",
"cebe/markdown": "^1.2",
"colinodell/json5": "^2.2",
"gitonomy/gitlib": "^1.3",
Expand Down
2 changes: 1 addition & 1 deletion resource/templates/quick-jump/jump.bash
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ __jump_completion() {
# - $term='hi'
local term="${COMP_WORDS[COMP_CWORD]}"

local commands=$(kite jump hint "$term" --no-name)
local commands=$(kite jump hint --no-name "$term")
# echo commands:
# echo $commands --- ${commands[@]}
# COMPREPLY=$commands
Expand Down
6 changes: 4 additions & 2 deletions resource/templates/quick-jump/jump.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# set +x # stop
# typeset -ft __jump_chpwd # start for given function
# typeset +ft __jump_chpwd # stop
# typeset -ft _jump_completion # start for given function
# typeset +ft _jump_completion # stop
#
# The following lines are autogenerated:

Expand Down Expand Up @@ -43,8 +45,8 @@ _jump_completion() {
kite util log "words: $words (w1: $words[1] w2: $words[2]) state: $state" --type "jump-comp2"

# commands+=($(kite jump hint "$@"))
commands+=($(kite jump hint $words[2] --flag 1))
histories+=($(kite jump hint $words[2] --flag 2))
commands+=($(kite jump hint --flag 1 $words[2]))
histories+=($(kite jump hint --flag 2 $words[2]))
# _describe -t 'commands' commands
_describe 'commands' commands -- histories
_alternative \
Expand Down
6 changes: 6 additions & 0 deletions script/phptests/json_encode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

$d = ['foo' => 'bar', 'baz' => 'long', 'emptySub' => []];

echo "Associative array always output as object: ", json_encode($d), "\n";
echo "Associative array always output as object: ", json_encode($d, JSON_FORCE_OBJECT), "\n\n";

0 comments on commit 8495032

Please sign in to comment.