Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start command completion only work executable item #416

Open
tsuyoshicho opened this issue Dec 26, 2021 · 4 comments
Open

start command completion only work executable item #416

tsuyoshicho opened this issue Dec 26, 2021 · 4 comments
Assignees

Comments

@tsuyoshicho
Copy link
Contributor

tsuyoshicho commented Dec 26, 2021

"start": &customComplete{Func: completionWhich, Name: "built-in `start` completer"},

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.

@hymkor hymkor self-assigned this Dec 28, 2021
@hymkor
Copy link
Collaborator

hymkor commented Dec 28, 2021

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
Copy link
Collaborator

hymkor commented Dec 31, 2021

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

@tsuyoshicho
Copy link
Contributor Author

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

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

@hymkor
Copy link
Collaborator

hymkor commented Jan 3, 2022

長くなるので、もう全部日本語で書いちゃいますが、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化するかもしれません。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants