Commit ce197340 authored by Antoine Catton's avatar Antoine Catton

Use argparse for slapcontainer

parent 7076f75c
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import ConfigParser import ConfigParser
import argparse
import sys import sys
import os import os
...@@ -8,8 +9,13 @@ import os ...@@ -8,8 +9,13 @@ import os
from . import prepare from . import prepare
def main(): def main():
parser = argparse.ArgumentParser(description="Slapcontainer binary")
parser.add_argument('configuration_file', type=str,
help="SlapOS configuration file.")
args = parser.parse_args()
slapos_conf = ConfigParser.ConfigParser() slapos_conf = ConfigParser.ConfigParser()
slapos_conf.read(sys.argv[1]) slapos_conf.read(args.configuration_file)
current_binary = os.path.join(os.getcwd(), sys.argv[0]) current_binary = os.path.join(os.getcwd(), sys.argv[0])
binary_directory = os.path.dirname(current_binary) binary_directory = os.path.dirname(current_binary)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment