Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/keyweeusr/butch
:fist_oncoming: The free Batch interpreter
https://github.com/keyweeusr/butch
batch batch-file batch-script batchfile cmd cmd-scripts emulation emulator hacktoberfest parsing tokenization
Last synced: 25 days ago
JSON representation
:fist_oncoming: The free Batch interpreter
- Host: GitHub
- URL: https://github.com/keyweeusr/butch
- Owner: KeyWeeUsr
- License: agpl-3.0
- Created: 2021-07-19T01:52:42.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-11-02T21:43:04.000Z (about 3 years ago)
- Last Synced: 2024-12-07T21:06:54.441Z (about 2 months ago)
- Topics: batch, batch-file, batch-script, batchfile, cmd, cmd-scripts, emulation, emulator, hacktoberfest, parsing, tokenization
- Language: Python
- Homepage:
- Size: 683 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
.. -*- fill-column: 79; mode: rst; eval: (flyspell-mode) -*-
==================================
Butch - The free Batch interpreter
==================================.. |butch| replace:: Butch Coolidge
.. _butch: https://pulpfiction.fandom.com/wiki/Butch_CoolidgeNamed after the famous Pulp Fiction boxer |butch|_ from Tennessee.
* Chat: ``__
**********
How to run
**********Installation
============.. code::
pip install butch
Post-Installation
-----------------.. |sitepkgs| replace:: ``site.getsitepackages()``
.. _sitepkgs: https://docs.python.org/3/library/site.html#site.getsitepackagesMake sure to run the test suite after the installation to verify everything
works as it should. The test suite is included in the package itself, so it
should be located in the first ``site-packages`` folder found via |sitepkgs|_... code::
python -m unittest discover \
$(python -c "import site;print(site.getsitepackages()[0])")/butchDevelopment
-----------Get the latest version:
.. code::
pip install https://github.com/KeyWeeUsr/butch/zipball/master
Running
=======Butch is available as a standalone executable as well as a Python module,
therefore it can be invoked by any of these commands if installed properly::butch
python -m butchwhich will launch the REPL (console) directly.
Use ``butch /C "echo Hello, Batch"`` for interpreting a Batch command from a
string or use ``butch /C hello.bat`` to run Batch from a file.Use ``/K`` switch instead of ``/C`` to jump into the console after a command or
a file finishes.Use ``butch /h`` to display help for other switches.
********
Features
********Commands
========.. |CD| replace:: CD
.. _CD: https://ss64.com/nt/cd.html- [ ] `ASSOC `__
- [ ] `CALL `__
- [X] |CD|_*pending:*
- [ ] ``/D`` change current drive + path
- [X] `CHDIR `__
- [X] `CLS `__
- [ ] `COLOR `__
- [ ] `COPY `__
- [X] `DATE `__*pending:*
- [ ] set the system date when called without arguments
- [X] `DEL `__
*pending:*
- [ ] ``/F`` force deleting of read-only files
- [ ] ``/S`` delete specified files from all subdirectories
- [ ] ``/A`` selects files to delete based on attributes- [X] `DIR `__
*pending:*
- [ ] Volume drive lookup
- [ ] Volume label on drive
- [ ] ``/A``
- [ ] ``/B``
- [ ] ``/C``
- [ ] ``/D``
- [ ] ``/L``
- [ ] ``/N``
- [ ] ``/O``
- [ ] ``/P``
- [ ] ``/Q``
- [ ] ``/S``
- [ ] ``/T``
- [ ] ``/W``
- [ ] ``/X``
- [ ] ``DIRCMD`` env variable preset- [X] `ECHO `__
- [ ] `ENDLOCAL `__
- [X] `ERASE `__
- [X] `EXIT `__
- [ ] `FOR `__
- [ ] `FTYPE `__
- [X] `GOTO `__
- [ ] `IF `__
- [X] `MD `__
- [X] `MKDIR `__
- [ ] `MKLINK `__
- [ ] `MOVE `__
- [X] `PATH `__
- [X] `PAUSE `__
- [X] `POPD `__
- [X] `PROMPT `__
- [X] `PUSHD `__
- [X] `RD `__
- [X] `REM `__
- [ ] `REN `__
- [X] `RMDIR `__
- [/] `SET `__*pending:*
- [X] single value adding (``set x=123``)
- [X] single value clearing (``set x=``)
- [X] listing all stored variables (``set``)
- [X] ``/P`` prompt for user input (``set /P x=prompt``)
- [ ] case-insensitive access, but case-sensitive output
- ...- [ ] `SETLOCAL `__
- [ ] `SHIFT `__
- [ ] `START `__
- [X] `TIME `__*pending:*
- [ ] set the system time when called without arguments
- [X] `TITLE `__
- [X] `TYPE `__
- [X] `VER `__
- [ ] `VERIFY `__
- [ ] `VOL `__
- [X] `:: `__
- [ ] External commands
- [ ] CLI prioritization of external commandsSyntax
======.. _reserved: https://ss64.com/nt/syntax-filenames.html#reserved
- [X] Echo off (``@``)
- [X] Quotes (``"``)
- [X] Quotes (``"``) in words
- [ ] Conditions (``IF``, ``ELSE``)
- [ ] Caret escaping (``^``)
- [/] Code blocks (``(``, ``)``)*pending:*
- [ ] nested blocks
- [X] multi-line block- [X] Redirection to commands (``|`` - pipes)
*pending:*
- [ ] ``RMDIR`` command doesn't pull ctx.output and related parts
- [ ] generic command I/O handling as a decorator/class?- [X] Output redirection (``>``, ``>>``)
- [X] Input redirection (``<``), e.g.: ``set /p key="prompt" < file``https://ss64.com/nt/syntax-redirection.html
- [ ] `Special (reserved) names `__
- [ ] Redirection to special (``nul``)
- [ ] Joining streams (STDIN, STDOUT, STDERR, UNDEFINED (3-9)) (``2>&1``)
- [ ] Command concatenation (``&``)
- [ ] Command concatenation (``&&``)
- [ ] Command concatenation (``||``)
- [ ] Recognize Windows path separator in path input (``\``)Console
=======.. |ANSI| replace:: ANSI
.. _ANSI: https://en.wikipedia.org/wiki/ANSI_character_set.. |UCS2| replace:: Unicode UCS-2 LE
.. _UCS2: https://en.wikipedia.org/wiki/Universal_Coded_Character_Set- [ ] ``/?`` as a proper help page trigger
- [ ] ``/T`` for foreground/background colors
- [ ] ``/A`` for printing only |ANSI|_ (which is most likely just 1252)
- [ ] ``/U`` for printing Unicode (|UCS2|_)
- [ ] ``/D`` registry with autorun commands (.bashrc, kind of) + ignore
- [ ] ``/E:ON|OFF``, ``/X``, ``/Y`` enable/disable command extensions
- [ ] ``/S`` quote stripping from commands
- [ ] ``/V:ON|OFF`` delayed expansion****
TODO
****- [ ] `Ensure `__ for dynamic type checking
- [ ] `Mypy `__ for static type checking
- [/] Documentation
- [X] PyPI package
- [ ] Library interface for programmatic emulation