Permalink
Browse files

Hook Augtool output class up to main program

  • Loading branch information...
1 parent 8179aeb commit 5b43e0c290e30aae5ca62f3aca1eaef0756ae05a @domcleal committed Apr 2, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 aug2cmds/__main__.py
View
11 aug2cmds/__main__.py
@@ -6,6 +6,7 @@
"""
import __init__ as aug2cmds
+import outputs
import argparse
def main():
@@ -21,7 +22,7 @@ def main():
action='store_const', const='yes',
help='always take default choices')
parser.add_argument('-f', '--format',
- choices=['augtool', 'puppet'],
+ choices=['augtool', 'puppet'], default="augtool",
help='output format')
parser.add_argument('path',
help='filename relative to ROOT to parse')
@@ -30,7 +31,13 @@ def main():
help='optional Augeas path inside file to process')
args = parser.parse_args()
- top = aug2cmds.PathNode(args.path, root=args.root, lens=args.lens)
+ pathnode = aug2cmds.PathNode(args.path, root=args.root, lens=args.lens)
+ if args.format == "augtool":
+ output = outputs.Augtool()
+ else:
+ raise RuntimeError("Unknown output format")
+ for cmd in output.visit(pathnode, args.augpath):
+ print cmd
if __name__ == "__main__":
main()

0 comments on commit 5b43e0c

Please sign in to comment.