• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

シェルスクリプト言語xyzshのソースコード。


コミットメタ情報

リビジョンe6937031845487331f4725d07d3efa18e748b1ad (tree)
日時2013-02-04 18:12:09
作者ab25cq <ab25cq@gmai...>
コミッターab25cq

ログメッセージ

1.3.4

変更サマリ

差分

--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,10 @@
11
2+2013 3rd Feburary version 1.3.4
3+
4+ 1. Added "-source" option to "completion" inner command.
5+
6+ 2. Added file name completion to "cd" inner command.
7+
28 2013 3rd Feburary version 1.3.3
39
410 1. Modified configure.in and Makfile.in especially for related with docdir and sysconfdir
--- a/completion.xyzsh
+++ b/completion.xyzsh
@@ -209,3 +209,18 @@ completion rl::help (
209209 rl::self | egrep native\ function\$ | egrep -v 'run|show' | root::scan '(^.+?):' | each ( | chomp | quote | pomch )
210210 )
211211
212+completion cd (
213+ | file_completion
214+ hash COMPLETION_OPTIONS -key cd
215+)
216+
217+completion __all__ (
218+ | file_completion
219+)
220+
221+root::compl::run( root::object sys )
222+
223+completion sys::__all__ (
224+ | file_completion
225+)
226+
--- a/help.xyzsh
+++ b/help.xyzsh
@@ -967,8 +967,10 @@ completion (オブジェクト::)コマンド名 (ブロック)
967967 root::complにオブジェクトとして登録される
968968 ARGVにはコマンド名と入力中の文字列が入っている
969969 コンテキストパイプには入力中の行が入っている
970-コマンド名に*を使うとコマンド名が見つからなかった時は*が使われる
970+コマンド名に__all__を使うとコマンド名が見つからなかった時は__all__が使われる
971971 ブロックが無かった場合は定義された補完を実行して結果を返す。
972+
973+-source ソースを表示する
972974 -
973975 help コマンド名
974976 -
@@ -1865,8 +1867,10 @@ completion (object name::)(command name) (block)
18651867 If there is a block, define the user completion in root::compl. Output of block is candidates for completion.
18661868 ARGV has a command name and an inputing string.
18671869 Context pipe has all inputing line.
1868-If you use * for command name, it is wild card.
1870+If you use __all__ for command name, it is wild card.
18691871 If there is not a block, run the completion and return output.
1872+
1873+-source output a source program of completion
18701874 -
18711875 help (command name)
18721876 -
@@ -1942,6 +1946,10 @@ write_history (file name)
19421946 read_history (file name)
19431947 -
19441948 ヒストリをファイルから読み出す
1949+-
1950+file_name_completion_null_generator
1951+-
1952+readlineの補完で補完がない場合にデフォルトの補完を使わないようにする
19451953 EOS | help::set_helps_ja
19461954
19471955 print <<<'EOS'
@@ -1980,6 +1988,10 @@ write readline cmdline history to a file
19801988 read_history (file name)
19811989 -
19821990 read readline cmdline history to the memory
1991+-
1992+file_name_completion_null_generator
1993+-
1994+Don't use default readline completion of file name.
19831995 EOS | help::set_helps
19841996 )
19851997
--- a/src/ext/migemo.dll.xyzsh
+++ b/src/ext/migemo.dll.xyzsh
@@ -1,3 +1,5 @@
1+print migemo.dll.xyzsh | p > /dev/null
2+
13 print "welcome to migemo.so dynamic library. You can read help type with \"migemo::help 'command name'\""\n
24
35 compl::run( root::object migemo )
--- a/src/ext/migemo.so.xyzsh
+++ b/src/ext/migemo.so.xyzsh
@@ -149,9 +149,18 @@ root::run(
149149 )
150150
151151 def file_completion (
152+ | chomp | split '(?<!\\) +' | length -line-num | var -local input_num
152153 | split '(?<!\\) +' | lines -1 | var -local inputing
153154
154- if(inputing | index -quiet /) (
155+ if(input_num | = 1\n) (
156+ ls | each (
157+ | if (|chomp| -d) (
158+ | chomp | xyzsh_quote | add / | pomch
159+ ) else (
160+ |chomp | xyzsh_quote| pomch
161+ )
162+ )
163+ ) elif (inputing | index -quiet /) (
155164 sys::dirname $(inputing|chomp| if (|rows -1 | = /) ( |add aaa ) else ( | print ) ) | var -local DIR
156165
157166 ls $(DIR|xyzsh_dequote|chomp) | each (
--- a/src/readline.c
+++ b/src/readline.c
@@ -721,26 +721,55 @@ BOOL cmd_completion(sObject* nextin, sObject* nextout, sRunInfo* runinfo)
721721 }
722722 /// output ///
723723 else if(runinfo->mBlocksNum == 0) {
724- int i;
725- for(i=1; i<runinfo->mArgsNumRuntime; i++) {
726- sObject* compl;
727- if(!get_object_from_str(&compl, runinfo->mArgsRuntime[i], runinfo->mCurrentObject, runinfo->mRunningObject, runinfo)) {
728- return FALSE;
729- }
724+ if(sRunInfo_option(runinfo, "-source")) {
725+ int i;
726+ for(i=1; i<runinfo->mArgsNumRuntime; i++) {
727+ sObject* compl;
728+ if(!get_object_from_str(&compl, runinfo->mArgsRuntime[i], runinfo->mCurrentObject, runinfo->mRunningObject, runinfo)) {
729+ return FALSE;
730+ }
731+
732+ if(compl && TYPE(compl) == T_COMPLETION) {
733+ sObject* block = SCOMPLETION(compl).mBlock;
734+ if(!fd_write(nextout, SBLOCK(block).mSource, strlen(SBLOCK(block).mSource)))
735+ {
736+ err_msg("signal interrupt", runinfo->mSName, runinfo->mSLine, runinfo->mArgs[0]);
737+ runinfo->mRCode = RCODE_SIGNAL_INTERRUPT;
738+ return FALSE;
739+ }
740+
741+ }
742+ else {
743+ err_msg("There is no object", runinfo->mSName, runinfo->mSLine, runinfo->mArgsRuntime[i]);
730744
731- if(compl && TYPE(compl) == T_COMPLETION) {
732- if(!run_object(compl, nextin, nextout, runinfo)) {
733745 return FALSE;
734746 }
735747 }
736- else {
737- err_msg("There is no object", runinfo->mSName, runinfo->mSLine, runinfo->mArgsRuntime[i]);
738748
739- return FALSE;
740- }
749+ runinfo->mRCode = 0;
741750 }
751+ else {
752+ int i;
753+ for(i=1; i<runinfo->mArgsNumRuntime; i++) {
754+ sObject* compl;
755+ if(!get_object_from_str(&compl, runinfo->mArgsRuntime[i], runinfo->mCurrentObject, runinfo->mRunningObject, runinfo)) {
756+ return FALSE;
757+ }
742758
743- runinfo->mRCode = 0;
759+ if(compl && TYPE(compl) == T_COMPLETION) {
760+ if(!run_object(compl, nextin, nextout, runinfo)) {
761+ return FALSE;
762+ }
763+ }
764+ else {
765+ err_msg("There is no object", runinfo->mSName, runinfo->mSLine, runinfo->mArgsRuntime[i]);
766+
767+ return FALSE;
768+ }
769+ }
770+
771+ runinfo->mRCode = 0;
772+ }
744773 }
745774 }
746775
@@ -881,6 +910,8 @@ BOOL cmd_readline_file_name_completion_null_generator(sObject* nextin, sObject*
881910 {
882911 rl_completion_entry_function = readline_filename_completion_null_generator;
883912
913+ runinfo->mRCode = 0;
914+
884915 return TRUE;
885916 }
886917