diff --git a/plugins/python/_python.fish b/plugins/python/_python.fish new file mode 100644 index 0000000..e634e5f --- /dev/null +++ b/plugins/python/_python.fish @@ -0,0 +1,8 @@ +# Use python2 if found, otherwise fallback to python. +function _python + if which python2 + python2 + else + python + end +end diff --git a/plugins/python/pybeautifyjson.fish b/plugins/python/pybeautifyjson.fish index ab2d9ca..74ef4c8 100644 --- a/plugins/python/pybeautifyjson.fish +++ b/plugins/python/pybeautifyjson.fish @@ -1,5 +1,5 @@ # beautify json string # use : pybeautifyjson '{"foo": "lorem", "bar": "ipsum"}' function pybeautifyjson - echo $argv | python -mjson.tool -end \ No newline at end of file + echo $argv | _python -mjson.tool +end diff --git a/plugins/python/pyhttp.fish b/plugins/python/pyhttp.fish index 06c6c8b..6199c12 100644 --- a/plugins/python/pyhttp.fish +++ b/plugins/python/pyhttp.fish @@ -5,5 +5,6 @@ function pyhttp else set HTTPPORT 1025 end - python -m SimpleHTTPServer $HTTPPORT; + + _python -m SimpleHTTPServer $HTTPPORT; end diff --git a/plugins/python/pysmtp.fish b/plugins/python/pysmtp.fish index 3872f48..cb75f31 100644 --- a/plugins/python/pysmtp.fish +++ b/plugins/python/pysmtp.fish @@ -5,6 +5,7 @@ function pysmtp else set SMTPPORT 1025 end + echo "smtp server started on port" $SMTPPORT; - python -m smtpd -n -c DebuggingServer localhost:$SMTPPORT; + _python -m smtpd -n -c DebuggingServer localhost:$SMTPPORT; end