Download Latest Version pysg.zip (16.3 kB)
Email in envelope

Get an email when there's a new version of pysg

Home
Name Modified Size InfoDownloads / Week
pysg-README.txt 2014-03-21 2.3 kB
pysg.zip.sig 2014-03-21 287 Bytes
pysg.zip 2014-03-21 16.3 kB
Totals: 3 Items   18.9 kB 0
pysg README:

pysg is a simple Python Script Generator written in bash. Here's how to "install" it:

First, you should move pysg and the pysg-dummy.txt file to a location you have added to your $PATH, so you can run it from everywhere in your filesystem.
Depending on said location, you will probably have to edit the main pysg script to make it work. Specifically, you must change the line

cat ~/bin/sh/pysg-dummy.txt > $DIR/$1

so that the location of the pysg-dummy.txt file is correct.

Now, for the usage:

In your terminal application, cd to the folder you want your python script to be generated at. It makes most sense to do this in a location you have added to your $PATH since pysg by default gives execution rights to your script. Doing it this way gives you the advantage of being able to run your freshly created script from everywhere in your filesystem.

As the first and only argument to pysg, give your desired filename, i.e:

pysg helloworld.py

pysg will now create a python file -in the directory you're in- with all the contents of the pydummy.txt file that comes with it, will give the user execution rights and open the file in vim for you to edit it right away.


Customization:

Well, in this early version, there aren't many things to customize... However, if you do not prefer to use vim for your scripting, edit the last line of the main pysg file, i.e. instead of

vim $DIR/$1

it becomes

emacs $DIR/$1

or

gedit $DIR/$1

or whatever depending on which editor you like most.


Also, you can of course edit the pysg-dummy.txt file so it's like you want to have it. 
Now, in the default version, it's going to give your operating system the location of the python 2.x interpreter that is installed on your system. If you want to change that behaviour, change the line

#!/bin/usr/python

to -depending on your system- something like:

#!/usr/bin/python3.


And of course also feel free to edit everything else you don't like about it.


Note for Windows Users:

Well, yes, I don't use Windows and therefore don't know how to change pysg so it works for you. And since I also don't care about making it run under Windows, if you want to do so, please do it yourself.

Happy coding and to you only all the best.

primlkubes
Source: pysg-README.txt, updated 2014-03-21