moke


Namemoke JSON
Version 1.2.5 PyPI version JSON
download
home_pagehttp://mcieslik-mctp.github.io/moke
Summarymoke is not like make
upload_time2023-10-22 18:30:20
maintainer
docs_urlNone
authorMarcin Cieslik
requires_python
licenseBSD License
keywords make ant rake paver build shell argparse bash
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ``moke`` is not like ``make``
#############################

Moke transforms a Python module into a command line script. Every function can
become a sub-command, with options inferred from the argument list and the
optional doc string.

A command line application that greets exactly two persons. (put the following
into a file called ``mokefile.py``::

  from moke import task, log

  @task
  def greet(who, shout=False, times=1):
      """
      Sends greetings from moke.

       - who(str2) two persons to greet
       - shout(switch) triggers CAPS

      """
      greetings = ("Hello %s and %s!" % (who[0], who[1])) * times
      if shout:
          greetings = greetings.upper()
      log("greeted: %s and %s" % (who[0], who[1]), INFO)

  if __name__ == "__main__":
      task()

Execute the mokefile by calling ``moke``::

  moke greet --shout -times 2 Mary Kate

this returns::

  2011-09-30 14:12:52,815 moke (version 1.0.0)
  2011-09-30 14:12:52,815 cwd: "/home/.../moke/test/scripts"
  2011-09-30 14:12:52,815 mokefile: "/home/.../moke/test/scripts/mokefile.py"
  2011-09-30 14:12:52,815 task: greet
  2011-09-30 14:12:52,815 params: ('who', ['Mary', 'Kate']) ('shout', True) ('times', 2)
  HELLO MARY AND KATE!
  HELLO MARY AND KATE!

If you forgot what your ``mokefile.py`` does, just ask for help::

  moke --help

  usage: mokefile.py [-h] [-ls LS] [-ll {info,warn,error}] [-lf {tab}]
    {greet} ...

  positional arguments:
    {greet}
      greet               Sends greetings from moke.

  optional arguments:
    -h, --help            show this help message and exit
    -ls LS                (file_a) [default: <stderr>] logging stream
    -ll {info,warn,error}
                          (str) [default: info] logging level
    -lf {tab}             (str) [default: tab] logging format

Sub-command specific help is also generated::

  moke greet --help

  usage: mokefile.py greet [-h] [--shout] [-times TIMES] who who

  positional arguments:
    who           (str) two persons to greet

  optional arguments:
    -h, --help    show this help message and exit
    --shout       (switch) triggers CAPS
    -times TIMES  (int) [default: 1]

Now it's time to start your own Mokefile::

  moke new [filename]

Which creates a skeleton file for you::
	
  $ moke new Mokefile
  moke: *** Created /...path.../Mokefile
  moke: *** Running 'moke Mokefile --help'

Have fun!



            

Raw data

            {
    "_id": null,
    "home_page": "http://mcieslik-mctp.github.io/moke",
    "name": "moke",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "make,ant,rake,paver,build,shell,argparse,bash",
    "author": "Marcin Cieslik",
    "author_email": "mcieslik@med.umich.edu",
    "download_url": "https://files.pythonhosted.org/packages/ee/fb/76cd9d63887c4e9de3192305fc67074def918a9b88e1da1a48c44f73498f/moke-1.2.5.tar.gz",
    "platform": null,
    "description": "``moke`` is not like ``make``\n#############################\n\nMoke transforms a Python module into a command line script. Every function can\nbecome a sub-command, with options inferred from the argument list and the\noptional doc string.\n\nA command line application that greets exactly two persons. (put the following\ninto a file called ``mokefile.py``::\n\n  from moke import task, log\n\n  @task\n  def greet(who, shout=False, times=1):\n      \"\"\"\n      Sends greetings from moke.\n\n       - who(str2) two persons to greet\n       - shout(switch) triggers CAPS\n\n      \"\"\"\n      greetings = (\"Hello %s and %s!\" % (who[0], who[1])) * times\n      if shout:\n          greetings = greetings.upper()\n      log(\"greeted: %s and %s\" % (who[0], who[1]), INFO)\n\n  if __name__ == \"__main__\":\n      task()\n\nExecute the mokefile by calling ``moke``::\n\n  moke greet --shout -times 2 Mary Kate\n\nthis returns::\n\n  2011-09-30 14:12:52,815 moke (version 1.0.0)\n  2011-09-30 14:12:52,815 cwd: \"/home/.../moke/test/scripts\"\n  2011-09-30 14:12:52,815 mokefile: \"/home/.../moke/test/scripts/mokefile.py\"\n  2011-09-30 14:12:52,815 task: greet\n  2011-09-30 14:12:52,815 params: ('who', ['Mary', 'Kate']) ('shout', True) ('times', 2)\n  HELLO MARY AND KATE!\n  HELLO MARY AND KATE!\n\nIf you forgot what your ``mokefile.py`` does, just ask for help::\n\n  moke --help\n\n  usage: mokefile.py [-h] [-ls LS] [-ll {info,warn,error}] [-lf {tab}]\n    {greet} ...\n\n  positional arguments:\n    {greet}\n      greet               Sends greetings from moke.\n\n  optional arguments:\n    -h, --help            show this help message and exit\n    -ls LS                (file_a) [default: <stderr>] logging stream\n    -ll {info,warn,error}\n                          (str) [default: info] logging level\n    -lf {tab}             (str) [default: tab] logging format\n\nSub-command specific help is also generated::\n\n  moke greet --help\n\n  usage: mokefile.py greet [-h] [--shout] [-times TIMES] who who\n\n  positional arguments:\n    who           (str) two persons to greet\n\n  optional arguments:\n    -h, --help    show this help message and exit\n    --shout       (switch) triggers CAPS\n    -times TIMES  (int) [default: 1]\n\nNow it's time to start your own Mokefile::\n\n  moke new [filename]\n\nWhich creates a skeleton file for you::\n\t\n  $ moke new Mokefile\n  moke: *** Created /...path.../Mokefile\n  moke: *** Running 'moke Mokefile --help'\n\nHave fun!\n\n\n",
    "bugtrack_url": null,
    "license": "BSD License",
    "summary": "moke is not like make",
    "version": "1.2.5",
    "project_urls": {
        "Homepage": "http://mcieslik-mctp.github.io/moke"
    },
    "split_keywords": [
        "make",
        "ant",
        "rake",
        "paver",
        "build",
        "shell",
        "argparse",
        "bash"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eefb76cd9d63887c4e9de3192305fc67074def918a9b88e1da1a48c44f73498f",
                "md5": "227632a2095e06f3eb429ff613ab180b",
                "sha256": "4f27a9c5b014b570cdaf5fa62577cb2c96d6da325fabd43696d29cb46551f8b8"
            },
            "downloads": -1,
            "filename": "moke-1.2.5.tar.gz",
            "has_sig": false,
            "md5_digest": "227632a2095e06f3eb429ff613ab180b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 209575,
            "upload_time": "2023-10-22T18:30:20",
            "upload_time_iso_8601": "2023-10-22T18:30:20.488200Z",
            "url": "https://files.pythonhosted.org/packages/ee/fb/76cd9d63887c4e9de3192305fc67074def918a9b88e1da1a48c44f73498f/moke-1.2.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-22 18:30:20",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "moke"
}
        
Elapsed time: 0.14389s