33
|
1 #!/usr/bin/env python
|
|
2 # -*- coding: utf-8 -*-
|
|
3
|
|
4 """
|
|
5 CLI commands for textshaper
|
|
6 """
|
|
7
|
|
8 class Shaper(object):
|
|
9 """individual text shaper component"""
|
|
10
|
|
11 def __init__(self, function):
|
|
12 self.function = function
|
|
13
|
|
14 class Commands(object):
|
|
15
|
|
16 def __init__(self):
|
|
17 self.shapers = []
|
|
18 self.keys = {}
|
|
19
|
|
20 def add(self, function, key=None):
|
|
21 self.shapers.append(Shaper(function))
|
|
22 if key:
|
|
23 self.keys[key] = self.shapers[-1]
|