Refactored (6)

Standardized (mostly) how the various classes are initialized.
This commit is contained in:
Chris Lane 2019-01-31 18:08:19 -05:00
parent 145a81dcd6
commit d61e4e7c34
3 changed files with 9 additions and 11 deletions

View File

@ -38,7 +38,6 @@ Examples:
from __future__ import print_function from __future__ import print_function
from cheat.colorize import Colorize from cheat.colorize import Colorize
from cheat.configuration import Configuration from cheat.configuration import Configuration
from cheat.editor import Editor
from cheat.sheet import Sheet from cheat.sheet import Sheet
from cheat.sheets import Sheets from cheat.sheets import Sheets
from docopt import docopt from docopt import docopt
@ -53,12 +52,10 @@ if __name__ == '__main__':
config.validate() config.validate()
# bootsrap # bootsrap
editor = Editor(config) sheets = Sheets(config)
sheet = Sheet(config, sheets)
colorize = Colorize(config) colorize = Colorize(config)
sheets = Sheets(config, colorize)
sheet = Sheet(sheets, editor)
# list directories # list directories
if options['--directories']: if options['--directories']:
print("\n".join(sheets.paths())) print("\n".join(sheets.paths()))

View File

@ -1,3 +1,4 @@
from cheat.editor import Editor
from cheat.utils import Utils from cheat.utils import Utils
import io import io
import os import os
@ -6,9 +7,9 @@ import shutil
class Sheet: class Sheet:
def __init__(self, sheets, editor): def __init__(self, config, sheets):
self._sheets = sheets self._sheets = sheets
self._editor = editor self._editor = Editor(config)
def copy(self, current_sheet_path, new_sheet_path): def copy(self, current_sheet_path, new_sheet_path):
""" Copies a sheet to a new path """ """ Copies a sheet to a new path """

View File

@ -1,14 +1,14 @@
from cheat.colorize import Colorize
from cheat.utils import Utils
import io import io
import os import os
from cheat.utils import Utils
class Sheets: class Sheets:
def __init__(self, config, colorize): def __init__(self, config):
self._config = config self._config = config
self._colorize = colorize; self._colorize = Colorize(config);
def default_path(self): def default_path(self):
""" Returns the default cheatsheet path """ """ Returns the default cheatsheet path """