-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from synek/release/v0.1
v0.1
- Loading branch information
Showing
19 changed files
with
247 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8000
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""Init command | ||
@author Rory Byrne <rory@rory.bio> | ||
""" | ||
from typing import Any | ||
|
||
from git_plan.cli.commands.command import Command | ||
from git_plan.service.project import ProjectService | ||
from git_plan.service.ui import UIService | ||
|
||
|
||
class Init(Command): | ||
"""Initialize git plan in the directory.""" | ||
|
||
subcommand = 'init' | ||
|
||
def __init__(self, project_service: ProjectService, **kwargs): | ||
super().__init__(**kwargs) | ||
assert project_service, "Project service not injected" | ||
self._project_service = project_service | ||
|
||
def pre_command(self): | ||
"""Check whether a plan already exists?""" | ||
pass | ||
|
||
def command(self, **kwargs): | ||
"""Initialize the project if it is not already initialized""" | ||
if not self._project.is_git_repository(): | ||
self._ui.bold("Not in a git repository.") | ||
return | ||
|
||
if self._project.is_initialized(): | ||
self._ui.bold("Git plan is already initialized.") | ||
else: | ||
self._project_service.initialize(self._project) | ||
self._ui.bold("Initialized git plan.") | ||
|
||
def register_subparser(self, subparsers: Any): | ||
subparsers.add_parser(Init.subcommand, help='Initialize git plan.') |
Oops, something went wrong.