Last active
June 3, 2016 15:20
-
-
Save roodkcab/5d7fdb4a795ace4b62fc9af5f4b8dcd9 to your computer and use it in GitHub Desktop.
sudolikeaboss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| /* | |
| #cgo CFLAGS: -x objective-c | |
| #cgo LDFLAGS: -framework Cocoa | |
| #import <Cocoa/Cocoa.h> | |
| int | |
| StartApp(void) { | |
| [NSAutoreleasePool new]; | |
| [NSApplication sharedApplication]; | |
| [NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited]; | |
| id menubar = [[NSMenu new] autorelease]; | |
| id appMenuItem = [[NSMenuItem new] autorelease]; | |
| [menubar addItem:appMenuItem]; | |
| [NSApp setMainMenu:menubar]; | |
| id appMenu = [[NSMenu new] autorelease]; | |
| id appName = [[NSProcessInfo processInfo] processName]; | |
| id quitTitle = [@"Quit " stringByAppendingString:appName]; | |
| id quitMenuItem = [[[NSMenuItem alloc] initWithTitle:quitTitle | |
| action:@selector(terminate:) keyEquivalent:@"q"] | |
| autorelease]; | |
| [appMenu addItem:quitMenuItem]; | |
| [appMenuItem setSubmenu:appMenu]; | |
| id window = [[[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) | |
| styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO] | |
| autorelease]; | |
| [window cascadeTopLeftFromPoint:NSMakePoint(20,20)]; | |
| [window setTitle:appName]; | |
| //[window makeKeyAndOrderFront:nil]; | |
| //[NSApp activateIgnoringOtherApps:YES]; | |
| [NSApp run]; | |
| return 0; | |
| } | |
| */ | |
| import "C" | |
| import ( | |
| "github.com/codegangsta/cli" | |
| "os" | |
| ) | |
| func main() { | |
| app := cli.NewApp() | |
| app.Name = "sudolikeaboss" | |
| app.Version = "0.2.0" | |
| app.Usage = "use 1password from the terminal with ease" | |
| app.Action = func(c *cli.Context) { | |
| go runSudolikeaboss() | |
| C.StartApp() | |
| } | |
| app.Run(os.Args) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment