summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2011-07-03 09:26:11 -0400
committerGravatar Jon Bernard <jbernard@tuxion.com> 2011-07-03 09:26:11 -0400
commitfc4a8aa87908585c9913d1ddd027845be48552e5 (patch)
tree386a4b2a78d5347fbfaf07ddad4bd1aa343392fc
parent66dd01b9f1d1c6fea4bf4db544045a8aa410b28d (diff)
downloaddotfiles-fc4a8aa87908585c9913d1ddd027845be48552e5.tar.gz
dotfiles-fc4a8aa87908585c9913d1ddd027845be48552e5.tar.bz2
dotfiles-fc4a8aa87908585c9913d1ddd027845be48552e5.zip
Add option to print version number
-rw-r--r--dotfiles/__init__.py5
-rw-r--r--dotfiles/cli.py8
-rw-r--r--dotfiles/core.py5
-rw-r--r--setup.py14
4 files changed, 24 insertions, 8 deletions
diff --git a/dotfiles/__init__.py b/dotfiles/__init__.py
index 0390200..fcb882b 100644
--- a/dotfiles/__init__.py
+++ b/dotfiles/__init__.py
@@ -1,8 +1,3 @@
# -*- coding: utf-8 -*-
-import cli
from core import *
-
-__version__ = '0.2.0'
-
-__all__ = ['cli', 'core']
diff --git a/dotfiles/cli.py b/dotfiles/cli.py
index 1e2437f..6618719 100644
--- a/dotfiles/cli.py
+++ b/dotfiles/cli.py
@@ -46,6 +46,10 @@ def parse_args():
parser.set_defaults(ignore=[])
parser.set_defaults(externals={})
+ parser.add_option("-v", "--version", action="store_true",
+ dest="show_version", default=False,
+ help="show version number and exit")
+
parser.add_option("-f", "--force", action="store_true", dest="force",
default=False, help="ignore unmanaged dotfiles (use with --sync)")
@@ -92,6 +96,10 @@ def main():
(opts, args) = parse_args()
+ if opts.show_version:
+ print 'dotfiles v%s' % core.__version__
+ exit(0)
+
config_defaults = {
'repository': opts.repo,
'prefix': opts.prefix,
diff --git a/dotfiles/core.py b/dotfiles/core.py
index 58310d2..d8ca5d1 100644
--- a/dotfiles/core.py
+++ b/dotfiles/core.py
@@ -11,6 +11,11 @@ import os
import shutil
+__version__ = '0.2.0'
+__author__ = "Jon Bernard"
+__license__ = "GPL"
+
+
class Dotfile(object):
def __init__(self, name, target):
diff --git a/setup.py b/setup.py
index a14a6c6..f41e668 100644
--- a/setup.py
+++ b/setup.py
@@ -1,8 +1,16 @@
-from distutils.core import setup
-import dotfiles
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+try:
+ from setuptools import setup
+except ImportError:
+ from distutils.core import setup
+
+from dotfiles.core import __version__
+
setup(name='dotfiles',
- version=dotfiles.__version__,
+ version=__version__,
description='Easily manage your dotfiles',
long_description=open('README.rst').read(),
author='Jon Bernard',