Closed kitashimauni closed 4 months ago
おぉ嬉しい
これってLinuxのインストールスクリプトみたくコピペだけでインストールできるかな
.ps1
ファイルならiex
って言う、「その場でファイルをダウンロードして実行する」便利なコマンドがPowerShellでつかえるの知ってたんだけど…
あ!iex
コマンドで .bat
実行できる可能性に気づいた
curl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.bat
でファイルの取得はできるけど、文字列をバッチファイルとしてそのまま動かす方法は不明
iexを試してみたけど@echo off
で引っかかってしまい、バッチファイルとして動かす方法はわからず…
わからなかったのでinstall.ps1
も作った
curl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.ps1 | powershell -
でインストール可能
(install.batもcurl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.bat | cmd - /q
で動くけど、if文の度にMore?
って出て邪魔になる)
両方ちゃんと動くようになった
install.bat
は全て1行で書いたので可読性はあれだけど…
curl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.bat | cmd - /q
curl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.ps1 | powershell -
のいずれかでインストール可能
インストールスクリプト自体はちゃんと動くんだけど、#import '@local/tuat-typst': tuatTemplate
ができない. これっておま環?
Windows 11 Home
typst compile
command (PowerShell
v7.4.2, v0.11.0 from winget
))typst compile
command (PowerShell
v7.4.2, v0.11.0 from cargo
))typst-preview
extension 0.11.4 (Visual Studio Code
v1.88.1)全部だめ
エラーがきもかった パスどうなってるんだ
❯ typst compile .\template.typ
error: file not found (searched at C:\Users\ojii3\AppData\Roaming\typst/packages/local/tuat-typst/0.1.0\typst.toml)
┌─ \\?\C:\Users\ojii3\Src\kitashimauni\tuat-typst\template.typ:1:8
│
1 │ #import "@local/tuat-typst:0.1.0": tuatTemplate
│ ^^^^^^^^^^^^^^^^^^^^^^^^^
少なくとも俺の環境のVSCode拡張のTypstでは,#import "@local/tuat-typst:0.1.0": tuatTemplate
がちゃんと動いてそう
curl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.ps1 | powershell -
でインストールした
❯ curl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.ps1 | powershell -
[info] DATA_DIR is set to: C:\Users\ojii3\AppData\Roaming
[info] git already installed
C:\Users\ojii3\AppData\Local\Temp/tuat-typst is already exist and delete this to continue
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove Directory" on target
"C:\Users\ojii3\AppData\Local\Temp\tuat-typst".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove Directory" on target
"C:\Users\ojii3\AppData\Local\Temp\tuat-typst\.git".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove Directory" on target
"C:\Users\ojii3\AppData\Local\Temp\tuat-typst\.git\hooks".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove File" on target
"C:\Users\ojii3\AppData\Local\Temp\tuat-typst\.git\hooks\applypatch-msg.sample".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Remove-Item : Object reference not set to an instance of an object.
At line:3 char:5
+ Remove-Item "$TEMP_DIR" -Force -Recurse -Confirm
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Remove-Item], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.
RemoveItemCommand
Canceled
ごめんこのエラーは関係なかった
AppData\Roaming\typst
とAppData\Local\Temp
全部消してcurl -fsSL https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.ps1 | powershell -
したらいけました。
削除とかコピーの動作が怪しいかも
あ~わかった
まえにじぶんで書いたps1のカスコピーののこりかすかも
iwr https://raw.githubusercontent.com/kitashimauni/tuat-typst/main/install.ps1 | iex
これでもいけた ダウンロードのほうは iwr
でした
ps1
と bat
のどちらが良いかという話がありまして
実は.bat
のほうが動作は安定しているかもしれない
一旦マージします〜
あとでreadmeにbatのワンライナーインストールスクリプト貼る感じで
Windows用のインストールスクリプト(権限不要)
import "@local/tuat-typst:0.1.0": tuatTemplate でimportできた
自分の環境(PowerShell 7.4.1)では動作確認済み