WSL(WindowsSubsystemforLinux)isanawesomebitofinnovationbyMicrosoftthatallowsyoutorunLinuxinsideofWindows10withouttheneedforaVirtualMachine.Thishasseveralbenefits,thelargestofwhichisthememorythatyousavebynotrunningawholesecondaryOS.Unfortunatelyitalsohasit'sdrawbacks,thebiggestofwhichisadistinctlackofsupportthrougheditorssuchasAtom,VSCode,andSublimeText.
Thegoalofthisprojectistocreateacollectionof"proxy"batchfilesthatcanbeusedtorouterequeststothelinuxversionofacommand.Almostallofthefileswillhavethesamelayout
@echooffbash.exe-c"php%*"Asanexampleusecasetaketheatom-linterpackage.Mostofthelinters,suchaslinter-phprequirethepathtoanexecutableinordertorun.IfthatexecutableisinsideofWSLhowever,thereisnowaytoaccessit.
Usingthewsl-proxyphp.batfilehowever,youcanjustreplacethepathtotheexecutablewithC:\\Users\\myuser\\path\\to\\wsl-proxy\\php.bat.RequestsarenowbeingroutedtothelinuxversionofPHP.
Protip:IfyouclonethisandaddthecloneddirectorytoyourwindowsPATHyouwillbeabletoaccessanyoftheproxiedcommandsthroughcommandprompt(evenwithoutthe.batextension)
Note:ThisisanexperimentcurrentlyandIcan'tguarenteeitwillworkwitheverything,butpleasefeelfreetoaddfileshere.Let'sturnthisintoaone-stopshopforwsl-proxyfiles.
Auto-generatingproxyfilesRuntheproxygen.cmdscripttoautomaticallygenerateproxies.Asubfoldernamed.\autogenwillbecreated,andalltheautogennedproxyfileswillbeplacedhere--addthisfoldertoyourWindowsPATHifyouwantaccesstotheproxiedcommandswithouttypinginafullpath.
Usage:
(Noargs):proxygenPromptsyoutoenterprogramnamesfromstdin(pressCTRL-Dwhendone).(Redirectfromfile):proxygen<program_name_fileSameasabove,butreadsprogramnamesfromafile.(Specifyargsoncommandline):proxygenprogram1program2...Examples:proxygengccg++proxygen/usr/bin/fooproxygen/usr/bin/*proxygen/usr/bin/*/bin/*
Programnameswillberesolvedtoabsolutepaths.Ifaprogramisnotfound,awarningmessagewillbedisplayed(theproxywillstillbecreated).
评论