Skip to content
This repository was archived by the owner on Sep 2, 2026. It is now read-only.

Formula Cookbook

Zavadsky Pasha edited this page Apr 26, 2015 · 3 revisions

###Simple example### You can easily add new formulae in Ale.

For example. It's Google search formula:

import webbrowser
from core import wcolors
from core import parser

class Formula():
    def __init__(self, request):
        self.request = request

    def search(self):
        print(wcolors.color.GREEN + "Searching in Google => " + wcolors.color.ENDC + wcolors.color.RED + parser.parse_request(self.request[0:]) + wcolors.color.ENDC)

        webbrowser.open('https://www.google.com/search?q=' + parser.parse_request(self.request[0:]))

    def main(self):
        self.search()

Your Formula class should include main method.

###Contributing###

  1. Fork Ale.

  2. Create your formula in Formula folder.

  3. git checkout -b {your formula name}

  4. git commit core/Formula/{your formula name}.py && git push

  5. Pull Request.

Clone this wiki locally