OSDN Git Service

common: alias o for WSL
authormagicant <magicant@048f04df-13f5-43d7-8114-9f9ceecaec24>
Sat, 21 Jan 2023 03:29:31 +0000 (03:29 +0000)
committermagicant <magicant@048f04df-13f5-43d7-8114-9f9ceecaec24>
Sat, 21 Jan 2023 03:29:31 +0000 (03:29 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/yash/yash/trunk@4229 048f04df-13f5-43d7-8114-9f9ceecaec24

NEWS
NEWS.ja
share/initialization/common

diff --git a/NEWS b/NEWS
index 87cb940..e37e5c2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,8 @@ Yash 2.54 (Unreleased)
      updated correctly in the "pushd" and "popd" built-ins.
   *  The effect of "!" no longer applies to the exit status of the
      "break", "continue", and "return" built-ins.
+  .  Updated the sample initialization script (yashrc):
+    +  The "o" alias for WSL
 
 ----------------------------------------------------------------------
 Yash 2.53 (2022-08-23)
diff --git a/NEWS.ja b/NEWS.ja
index c5e8c1b..222ba63 100644 (file)
--- a/NEWS.ja
+++ b/NEWS.ja
@@ -34,6 +34,8 @@ Yash 2.54 (未リリース)
      組込みで $DIRSTACK 変数の値が正しく更新されていなかった
   *  "break", "continue", "return" 組込みの終了ステータスが "!" で反転
      されていた
+  .  初期化スクリプト (yashrc) のサンプルを更新:
+    +  WSL 用の "o" エイリアスを定義
 
 ----------------------------------------------------------------------
 Yash 2.53 (2022-08-23)
index 4c3ea34..405a425 100644 (file)
@@ -161,6 +161,13 @@ fi
 # an alias that opens a file
 if command --identify xdg-open >/dev/null 2>&1; then
   alias o='xdg-open'
+elif command --identify cmd.exe wslpath >/dev/null 2>&1; then
+  alias o='open'
+  open() (
+    target="$(wslpath -w "$1")"
+    cd /mnt/c # suppress UNC path warning
+    cmd.exe /c start "$target"
+  )
 elif command --identify cygstart >/dev/null 2>&1; then
   alias o='cygstart'
 elif [ "$(uname)" = Darwin ] 2>/dev/null; then