Esempio n. 1
0
def test_write(tmpdir):
    test_file = tmpdir.join('test.conf') 
    conf = JSONConfigParser(storage=test_file.strpath)
    conf['test'] = "Yes"
    conf.write()

    contents = test_file.read()

    assert "test" in contents
    assert "Yes" in contents
Esempio n. 2
0
    help="Used with the addfile command to read in another file.",
    default=""
    )

parser.add_argument(
    "-v",
    "--value",
    help="Used with several commands that require a value.",
    default=""
    )

parser.add_argument(
    "-m",
    "--multi",
    help="Boolean flag for the append command for handling multiple results along the path. Defaults to false.",
    action="store_true"
    )

parser.add_argument(
    '-c',
    '--convert',
    help="Optional convert flag for appending action.",
    default=False
    )

if __name__ == "__main__":
    args = parser.parse_args()
    conf = JSONConfigParser(source=args.file, storage=args.file)
    call(args.command, conf, args)
    conf.write()
Esempio n. 3
0
    default="$")

parser.add_argument(
    "-o",
    "--other",
    help="Used with the addfile command to read in another file.",
    default="")

parser.add_argument("-v",
                    "--value",
                    help="Used with several commands that require a value.",
                    default="")

parser.add_argument(
    "-m",
    "--multi",
    help=
    "Boolean flag for the append command for handling multiple results along the path. Defaults to false.",
    action="store_true")

parser.add_argument('-c',
                    '--convert',
                    help="Optional convert flag for appending action.",
                    default=False)

if __name__ == "__main__":
    args = parser.parse_args()
    conf = JSONConfigParser(source=args.file, storage=args.file)
    call(args.command, conf, args)
    conf.write()