diff options
| author | Paul C. Buetow (mars.fritz.box) <paul@buetow.org> | 2014-04-29 08:14:46 +0200 |
|---|---|---|
| committer | Paul C. Buetow (mars.fritz.box) <paul@buetow.org> | 2014-04-29 08:14:46 +0200 |
| commit | 34dd414cebebcc9059d15870c2ea2a1c396895c5 (patch) | |
| tree | 11c4b2310da5b02d5772d8938409151f48edff73 | |
| parent | 56ec0398d58b192c6870a636e91ecede7ce5943c (diff) | |
introduce -n for no-op
| -rwxr-xr-x | src/fapi | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -138,6 +138,7 @@ class ArgumentParser(FapiBase): parser.add_argument('-h', action='store_true', help='Print this help') parser.add_argument('-i', action='store_true', help='Interactive shell') parser.add_argument('-l', action='store_true', help='Use list output') + parser.add_argument('-n', action='store_true', help='No-op (don\'t do actual stuff)') parser.add_argument('-v', action='store_true', help='Verbose') parser.add_argument('-V', action='store_true', help='Print program version') parser.add_argument('-C', action='store', help='Config file', @@ -691,10 +692,13 @@ class Fapi(FapiBase): print "BULK" lazy = self._lazy() if isfunction(lazy): - self.verbose('Doing some stuf via the API, it may take a while') - self.__login() - self.out(lazy()) - self.info('done', Fore.GREEN) + if a.n: + self.info('no-op', Fore.GREEN) + else: + self.verbose('Doing some stuf via the API, it may take a while') + self.__login() + self.out(lazy()) + self.info('done', Fore.GREEN) else: self.print_synopsis() return 1 |
