nyagos icon indicating copy to clipboard operation
nyagos copied to clipboard

`start` command completion only work executable item

Open tsuyoshicho opened this issue 3 years ago • 4 comments

https://github.com/nyaosorg/nyagos/blob/ae9f3228e6652a1332ec66742f9fd8963ee6452e/completion/completion.go#L86

Currently naygos built-in start has "completion" that completing arguments only executable file.

But windows cmd start supported below these:

  • start "exec" , then open new window and execute "exec" (Win32GUI app directly start, CLI item run as new cmd) - now support
  • start "file", then open "file" with system file handler.
  • start "dir", then open "dir" explorer and other (directory handler)

Nyagos start manually set and open file/dir OK, work fine.

Suggestion:

Support both document and directory add to start completion.

tsuyoshicho avatar Dec 26 '21 09:12 tsuyoshicho

OK. I understand it should complete to any file on the %PATH%. It requires an new completion function.

Memo for myself

  • start book1.xlsx in CMD.EXE can open book1.xlsx on the %PATH% even although the suffix .xlsx does not exist in the %PATHEXT%.

hymkor avatar Dec 28 '21 10:12 hymkor

Implemented ! 実装しました

When the base string user input does not contains / or \ , the shell searches all filenames on the directories listed %PATH%. 元文字列が / や \ を含んでなければ、%PATH% に含まれる全ファイルを検索します。

The change will be included in the next binary release. 次のバイナリリリースに含められる予定です。

@tsuyoshicho

hymkor avatar Dec 31 '21 10:12 hymkor

Basically it work is good. 基本問題ないと思います。

(PATHの設定如何で微妙なアイテムも出てしまいますが、それはまあユーザー責でしょうし)

tsuyoshicho avatar Dec 31 '21 11:12 tsuyoshicho

長くなるので、もう全部日本語で書いちゃいますが、CMD.EXE 互換の start の仕様的に「補完しすぎ」だったようです。

START ["タイトル"] [/D パス] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
      [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
      [/NODE <NUMA ノード>] [/AFFINITY <16 進数の関係マスク>] [/WAIT] [/B]
      [コマンド/プログラム] [パラメーター]

[パラメーター] 部分の補完まで「%PATH% に含まれる全ファイルを検索」をやってしまっていたのですが、こここは「普通のファイル名補完」にとどめておくべきでした。%PATH% を検索するのは [コマンド/プログラム] の部分のみにすべきでした。このあたり、そのうち直します。

また、nyagos の start は Lua 関数で実装していたのですが、Lua で実装しているコマンドに対して、Goコードで補完していました(これは前からそうだった)。これはアンバランスなので、そのうち start コマンドもGo化するかもしれません。

hymkor avatar Jan 03 '22 13:01 hymkor