From d048ea5a10ab9dff08dd603f558afc58a085fc0f Mon Sep 17 00:00:00 2001 From: Aroonav Mishra Date: Sun, 12 Nov 2017 18:48:04 +0530 Subject: [PATCH 1/2] Enable starting the cheat python script on windows. For this add a small batch script in the same directory as the cheat script. --- bin/cheat.bat | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 bin/cheat.bat diff --git a/bin/cheat.bat b/bin/cheat.bat new file mode 100644 index 0000000..08f713f --- /dev/null +++ b/bin/cheat.bat @@ -0,0 +1,10 @@ +@echo off + +if not defined EDITOR (set EDITOR=write) + +:: Retrieve the path to python executable. +for /f "delims=" %%A in ('where python') do set "PATHOFPYTHON=%%A" +%PATHOFPYTHON% %PATHOFPYTHON%\..\Scripts\cheat %* + +:: Remove this variable to avoid polluting the environment. +set PATHOFPYTHON= From fcb82778e4a7d5366372f5ee4617f4a7644ae624 Mon Sep 17 00:00:00 2001 From: Aroonav Mishra Date: Tue, 5 Feb 2019 12:18:26 +0530 Subject: [PATCH 2/2] * Corrected the logic to execute the cheat script. * Check VISUAL, CHEAT_EDITOR, EDITOR environment variables before falling back to wordpad as the default editor. --- bin/cheat.bat | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/bin/cheat.bat b/bin/cheat.bat index 08f713f..3f66754 100644 --- a/bin/cheat.bat +++ b/bin/cheat.bat @@ -1,10 +1,8 @@ -@echo off +@echo OFF -if not defined EDITOR (set EDITOR=write) +if not defined CHEAT_EDITOR if not defined EDITOR if not defined VISUAL ( + set CHEAT_EDITOR=write +) -:: Retrieve the path to python executable. -for /f "delims=" %%A in ('where python') do set "PATHOFPYTHON=%%A" -%PATHOFPYTHON% %PATHOFPYTHON%\..\Scripts\cheat %* - -:: Remove this variable to avoid polluting the environment. -set PATHOFPYTHON= +REM %~dp0 is black magic for getting directory of script +python %~dp0cheat %*