Ejemplo n.º 1
0
Archivo: fu.py Proyecto: benvd/fu
def do_copy(index, results):
		
		try:
				# extract the command, get a handle to user's clipboard and copy the command 
				command = json.loads(results)[index-1]['command']
				user_system = system()
				user_system.copy(command)
				
				# notify the user
				print "%s Copied to Clipboard!\n\t%s" % (color.cyan('fu'), color.green(command) )

		except:
				# catch invalid index	
				print "%s: %s invalid index number!" % ( color.cyan('fu'), color.fail('Error') )
Ejemplo n.º 2
0
def do_open( index, results ):

		try :

				# Extract the command, get a handle of the user's os and launch the url in a browser
				url = json.loads(results)[index-1]['url']
				user_system  = system()
				user_system.open(url)
				
				# notify the user
				print "%s Opening %s" %(color.cyan('fu!'), color.yellow(url) )

		except :
				# catch invalid index
				print "%s: %s invalid index number!" % ( color.cyan('fu'), color.fail('Error') )