You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
878 B
31 lines
878 B
# init command
|
|
|
|
import os
|
|
try:
|
|
import ConfigParser as configparser
|
|
except ImportError:
|
|
import configparser
|
|
|
|
from ..repo import Repository
|
|
from .. import color
|
|
|
|
|
|
def parser(subparsers, config):
|
|
parser = subparsers.add_parser('init', help="initialize the .papers directory")
|
|
return parser
|
|
|
|
|
|
def command(config):
|
|
"""Create a .papers directory"""
|
|
papersdir = os.getcwd() + '/.papers'
|
|
if not os.path.exists(papersdir):
|
|
print('{}initializing papers in {}{}{}'.format(
|
|
color.grey, color.cyan, papersdir, color.end))
|
|
repo = Repository(papersdir=papersdir)
|
|
repo.init() # Creates directories
|
|
repo.save() # Saves empty repository description
|
|
else:
|
|
print('{}error {} : papers already present in {}{}{}'.format(
|
|
color.red, color.grey, color.cyan, papersdir, color.end))
|
|
exit(-1)
|