aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/plugins/command_init.py
diff options
context:
space:
mode:
authorLibravatarAgustin Henze <tin@sluc.org.ar>2012-12-12 20:15:50 -0300
committerLibravatarAgustin Henze <tin@sluc.org.ar>2012-12-12 20:15:50 -0300
commit540e6aa6fcd86a98e270715d1d4e49493eacc270 (patch)
treead1b1fcca82d9638f5edcf7a4d9149ca113ba2d2 /nikola/plugins/command_init.py
parent25744f4bf462020e353c503db3ec558604c19137 (diff)
parent0f2c04e70a0ffdd0892d6970cafbcd952d221db5 (diff)
Merge tag 'upstream/5'
Upstream version 5
Diffstat (limited to 'nikola/plugins/command_init.py')
-rw-r--r--nikola/plugins/command_init.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/nikola/plugins/command_init.py b/nikola/plugins/command_init.py
new file mode 100644
index 0000000..a032370
--- /dev/null
+++ b/nikola/plugins/command_init.py
@@ -0,0 +1,34 @@
+from optparse import OptionParser
+import os
+import shutil
+
+import nikola
+from nikola.plugin_categories import Command
+
+
+class CommandInit(Command):
+ """Create a new site."""
+
+ name = "init"
+
+ usage = """Usage: nikola init folder [options].
+
+That will create a sample site in the specified folder.
+The destination folder must not exist.
+"""
+
+ def run(self, *args):
+ """Create a new site."""
+ parser = OptionParser(usage=self.usage)
+ (options, args) = parser.parse_args(list(args))
+
+ target = args[0]
+ if target is None:
+ print self.usage
+ else:
+ src = os.path.join(os.path.dirname(nikola.__file__),
+ 'data', 'samplesite')
+ shutil.copytree(src, target)
+ print "A new site with some sample data has been created at %s."\
+ % target
+ print "See README.txt in that folder for more information."