Skip to content

Commit

Permalink
Project refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
jasursadikov committed Sep 9, 2024
1 parent 378e742 commit 4379dcf
Show file tree
Hide file tree
Showing 4 changed files with 421 additions and 420 deletions.
34 changes: 5 additions & 29 deletions mud.py → app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,15 @@
import asyncio
import argparse
import subprocess
import commands
import config
import utils

from argparse import ArgumentParser
from styles import *
from commands import *
from argparse import ArgumentParser
from runner import Runner

# Filters
TABLE_ATTR = '-t', '--table'
LABEL_PREFIX = '-l=', '--label='
NOT_LABEL_PREFIX = '-nl=', '--not-label='
BRANCH_PREFIX = '-b=', '--branch='
MODIFIED_ATTR = '-m', '--modified'
DIVERGED_ATTR = '-d', '--diverged'
# Commands
ADD = ['add', 'a']
REMOVE = ['remove', 'rm']
LOG = ['log', 'l']
INFO = ['info', 'i']
INIT = ['init']
TAGS = ['tags', 'tag', 't']
LABELS = ['labels', 'lb']
STATUS = ['status', 'st']
BRANCHES = ['branch', 'branches', 'br']
HELP = ['help', '--help', '-h']
UPDATE = ['update']
VERSION = ['--version', '-v', 'version']
CONFIGURE = ['configure', 'config']
SET_GLOBAL = ['--set-global']
COMMANDS = [ADD, REMOVE, LOG, INFO, INIT, TAGS, LABELS, STATUS, BRANCHES, HELP, UPDATE, VERSION, CONFIGURE, SET_GLOBAL]


class Mud:
class App:
def __init__(self):
self.cmd_runner = None
self.config = None
Expand Down Expand Up @@ -111,7 +87,7 @@ def run(self) -> None:
self.config.find()
self._filter_repos()

self.cmd_runner = commands.Commands(self.config)
self.cmd_runner = Runner(self.config)
# Handling commands
if len(sys.argv) > 1 and sys.argv[1] in [cmd for group in COMMANDS for cmd in group]:
args = self.parser.parse_args()
Expand Down
Loading

0 comments on commit 4379dcf

Please sign in to comment.