コード例 #1
0
ファイル: config.py プロジェクト: zimbatm/fluxboxlauncher
 def test_remove(self):
     conf = Conf('primtux')
     lines = startup.split('\n')
     lines = [line + '\n' for line in lines]
     r = conf.load(lines[:-1])
     has_removed = conf.remove(conf.get_soft('/usr/local/bin/primtux/handymenu-maxi'))
     assert has_removed == True
     assert str(conf) == startup_delete
コード例 #2
0
ファイル: moodle-alias.py プロジェクト: danpoltawski/mdk
    for alias, command in aliases.items():
        print '{0:<20}: {1}'.format(alias, command)

elif args.command == 'show':
    if len(args.arguments) != 1:
        debug(
            'Too few/many arguments. One needed: moodle alias show aliasName')
        sys.exit(1)
    alias = C.get('aliases.%s' % args.arguments[0])
    if alias != None:
        debug(alias)

elif args.command == 'add':
    if len(args.arguments) < 2:
        debug(
            'Too few/many arguments. Two needed: moodle alias add aliasName Command To Perform'
        )
        sys.exit(1)
    alias = args.arguments[0]
    command = ' '.join(args.arguments[1:])
    C.add('aliases.%s' % alias, command)

elif args.command == 'remove':
    if len(args.arguments) != 1:
        debug(
            'Too few/many arguments. One needed: moodle alias remove aliasName'
        )
        sys.exit(1)
    alias = args.arguments[0]
    C.remove('aliases.%s' % alias)
コード例 #3
0
ファイル: moodle-alias.py プロジェクト: danpoltawski/mdk
parser.add_argument('arguments', type=str, metavar='arguments', default=None, nargs=argparse.REMAINDER, help='arguments for the command')
args = parser.parse_args()

if args.command == 'list':
    aliases = C.get('aliases')
    for alias, command in aliases.items():
        print '{0:<20}: {1}'.format(alias, command)

elif args.command == 'show':
    if len(args.arguments) != 1:
        debug('Too few/many arguments. One needed: moodle alias show aliasName')
        sys.exit(1)
    alias = C.get('aliases.%s' % args.arguments[0])
    if alias != None:
        debug(alias)

elif args.command == 'add':
    if len(args.arguments) < 2:
        debug('Too few/many arguments. Two needed: moodle alias add aliasName Command To Perform')
        sys.exit(1)
    alias = args.arguments[0]
    command = ' '.join(args.arguments[1:])
    C.add('aliases.%s' % alias, command)

elif args.command == 'remove':
    if len(args.arguments) != 1:
        debug('Too few/many arguments. One needed: moodle alias remove aliasName')
        sys.exit(1)
    alias = args.arguments[0]
    C.remove('aliases.%s' % alias)