Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
allow script via -c
Browse files Browse the repository at this point in the history
  • Loading branch information
hjacobs committed Mar 13, 2019
1 parent 406f4a6 commit 239eaa1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pykube/__main__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import argparse
import code

import pykube

config = pykube.KubeConfig.from_file()

parser = argparse.ArgumentParser()
parser.add_argument('--kubeconfig', help='Path to the kubeconfig file to use')
parser.add_argument('-c', help='Python program passed in as string')
args = parser.parse_args()

config = pykube.KubeConfig.from_file(args.kubeconfig)
api = pykube.HTTPClient(config)

context = {
Expand All @@ -25,4 +32,7 @@
Use Ctrl-D to exit'''

console = code.InteractiveConsole(locals=context)
console.interact(banner)
if args.c:
console.runsource(args.c)
else:
console.interact(banner)

0 comments on commit 239eaa1

Please sign in to comment.