Skip to content

Instantly share code, notes, and snippets.

@matiasmm
Created June 6, 2012 17:23
Show Gist options
  • Save matiasmm/2883408 to your computer and use it in GitHub Desktop.
Save matiasmm/2883408 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sys
import os
class Context:
def __init__(self):
self.netbeans="~/netbeans-7.2beta/bin/netbeans"
self.context_dir = ".contexts"
def open(self, context):
self.context_file = self.context_dir + "/" + context
print self.context_file
f = open(self.context_file, 'r')
args = f.read().replace("\n", ' ')
os.system(self.netbeans+ " " + args)
def exists(self, context):
self.context_file = self.context_dir + "/" + context
return os.path.exists(self.context_file)
def create(self, context):
if(False == os.path.exists(self.context_dir)):
os.mkdir(self.context_dir)
filename = self.context_dir + "/"+ context
f = open(filename,"w")
input = raw_input("Ingrese archivos: ")
f.write(input)
f.close()
argv1 = sys.argv[1]
c = Context()
if(argv1):
if(c.exists(argv1)):
c.open(argv1)
else:
c.create(argv1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment