Skip to content

Commit

Permalink
Merge branch 'main' of github.com:bjasspa/jasspa
Browse files Browse the repository at this point in the history
  • Loading branch information
bjasspa committed Nov 23, 2024
2 parents 08d1fae + 45c35eb commit 4158465
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
3 changes: 2 additions & 1 deletion microemacs/macros/python.eaf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"" "</FOLD><FOLD+> \ecCControl Flow:\ecA"
main "#!/usr/bin/env python3\r# -*- coding: ISO-8859-15 -*-\r\"\"\"\pModule docstring\"\"\"\r__author__ = \"first last\"\r__version__ = \"0.1\"\rimport sys, os, re\r\rdef usage(argv):\r\Tprint(f\"Usage: {argv[0]} args\")\r\r\Tprint(__doc__)\r\rdef main(argv):\r\Tif (len(argv)) == 1:\r\Tusage(argv)\r\rif __name__ == \"__main__\":\r\Tmain(sys.argv)\r\r\P" " main"
main "#!/usr/bin/env python3\r# -*- coding: ISO-8859-15 -*-\r\"\"\"\pModulename\r\rUsage: {0} ?-h,-?,--help?\r\rArguments:\r\"\"\"\r__author__ = \"first last\"\r__version__ = \"0.1\"\rimport sys, os, re\r\rdef help(argv):\r\Tprint(__doc__.format(argv[1]))\r\rdef usage(argv):\r\Tprint(f\"Usage: {argv[0]} args\")\r\rdef main(argv):\r\Tif (len(argv)) == 1:\r\Tusage(argv)\r\r\Telif \"-h\" in argv or \"--help\" in argv:\r\Thelp(argv)\r\rif __name__ == \"__main__\":\r\Tmain(sys.argv)\r\r\P" " main"
enc "# -*- coding: ISO-8859-\p -*-\r\P" " enc"
enc15 "# -*- coding: ISO-8859-15 -*-\r" " enc15"
enc1252 "# -*- coding: cp1252 -*-\r" " enc1252"
Expand All @@ -14,6 +14,7 @@ eli "elif \p:\P" " eli(f)"
els "else:\r\T" " els(e)"
whi "while (\p):\r\P" " whi(le)"
for "for \p in range(10):\P" " for"
l2d "dct=dict({})\rfor i in range(1,len(\plst),2):\r\Tkey = lst[i]\rval = lst[i+1]\rdct[key]=val\r\P" " l2d"
iffile "if not os.path.isfile(\p):\P" " iffile"
openr "file = open(\p,'r')\rfor line in file:\r print(line)\rfile.close()\r\P" " openr"
openw "out = open(\p,'w')\rout.write('')\rout.close()\r\P" " openw"
Expand Down
42 changes: 32 additions & 10 deletions microemacs/macros/python.etf
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
#!/usr/bin/env python3
import sys, os, re
"""Module docstring
Description ...
Usage: {0} usage line ...
Arguments:
Mandatory:
Options:
"""
import sys
import os

def mhelp(argv):
"""help function for the module"""
print(__doc__.format(argv[0]))

def usage(argv):
print(f"Usage: {argv[0]} args")

"""displays a short usage line"""
print(f"Usage: {argv[0]} FILENAME")

def main(argv):
pass

if __name__ == "__main__":
if len(sys.argv) == 1:
usage(sys.argv)
"""main function of a possible command line application"""
if len(argv) == 1:
usage(argv)
elif "-h" in argv or "--help" in argv:
help(argv)
else:
main(sys.argv)

if os.path.isfile(argv[1]):
print("running ...")

if __name__ == "__main__":
main(sys.argv)

0 comments on commit 4158465

Please sign in to comment.