-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from hirosassa/add-google-drive
add google workspace commands
- Loading branch information
Showing
6 changed files
with
377 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,9 @@ | |
[google] | ||
[google.alias] | ||
|
||
[googleworkspace] | ||
[googleworkspace.alias] | ||
|
||
[youtube] | ||
[youtube.alias] | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
// Copyright 2019 The Biko Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package cli | ||
|
||
import ( | ||
"github.com/KeisukeYamashita/biko/browser" | ||
"github.com/KeisukeYamashita/biko/providers/googleworkspace" | ||
"github.com/urfave/cli" | ||
) | ||
|
||
func newGoogleWorkspaceCmd() cli.Command { | ||
return cli.Command{ | ||
Name: "googleworkspace", | ||
Aliases: []string{"gw"}, | ||
Usage: "Open Google Workspace resource", | ||
Category: categoryWebService, | ||
Flags: []cli.Flag{}, | ||
Action: func(c *cli.Context) error { | ||
g, err := googleworkspace.GetProvider() | ||
if err != nil { | ||
return err | ||
} | ||
return browser.Open(c, g) | ||
}, | ||
Subcommands: []cli.Command{ | ||
newDriveCmd(), | ||
newDocumentCmd(), | ||
newSpreadsheetsCmd(), | ||
newPresentationCmd(), | ||
newFormsCmd(), | ||
}, | ||
} | ||
} | ||
|
||
func newDriveCmd() cli.Command { | ||
return cli.Command{ | ||
Name: "drive", | ||
Aliases: []string{"dr"}, | ||
Usage: "Open Google Drive directory", | ||
Flags: []cli.Flag{ | ||
cli.StringFlag{ | ||
Name: "query, q", | ||
Usage: "Query to search", | ||
}, | ||
}, | ||
Action: func(c *cli.Context) error { | ||
g, err := googleworkspace.GetProvider() | ||
if err != nil { | ||
return err | ||
} | ||
return browser.Open(c, g) | ||
}, | ||
} | ||
|
||
} | ||
|
||
func newDocumentCmd() cli.Command { | ||
return cli.Command{ | ||
Name: "document", | ||
Aliases: []string{"doc"}, | ||
Usage: "Open Google Document page", | ||
Flags: []cli.Flag{ | ||
cli.StringFlag{ | ||
Name: "query, q", | ||
Usage: "Query a page", | ||
}, | ||
cli.BoolFlag{ | ||
Name: "new, n", | ||
Usage: "Create a new document (this flag prioritize over query flag)", | ||
}, | ||
}, | ||
Action: func(c *cli.Context) error { | ||
g, err := googleworkspace.GetProvider() | ||
if err != nil { | ||
return err | ||
} | ||
return browser.Open(c, g) | ||
}, | ||
} | ||
|
||
} | ||
|
||
func newSpreadsheetsCmd() cli.Command { | ||
return cli.Command{ | ||
Name: "spreadsheets", | ||
Aliases: []string{"ss"}, | ||
Usage: "Open Google Spreadsheets page", | ||
Flags: []cli.Flag{ | ||
cli.StringFlag{ | ||
Name: "query, q", | ||
Usage: "Query a page", | ||
}, | ||
cli.BoolFlag{ | ||
Name: "new, n", | ||
Usage: "Create a new spreadsheet (this flag prioritize over query flag)", | ||
}, | ||
}, | ||
Action: func(c *cli.Context) error { | ||
g, err := googleworkspace.GetProvider() | ||
if err != nil { | ||
return err | ||
} | ||
return browser.Open(c, g) | ||
}, | ||
} | ||
|
||
} | ||
|
||
func newPresentationCmd() cli.Command { | ||
return cli.Command{ | ||
Name: "presentation", | ||
Aliases: []string{"pr"}, | ||
Usage: "Open Google Slides page", | ||
Flags: []cli.Flag{ | ||
cli.StringFlag{ | ||
Name: "query, q", | ||
Usage: "Query a page", | ||
}, | ||
cli.BoolFlag{ | ||
Name: "new, n", | ||
Usage: "Create a new presentation (this flag prioritize over query flag)", | ||
}, | ||
}, | ||
Action: func(c *cli.Context) error { | ||
g, err := googleworkspace.GetProvider() | ||
if err != nil { | ||
return err | ||
} | ||
return browser.Open(c, g) | ||
}, | ||
} | ||
|
||
} | ||
|
||
func newFormsCmd() cli.Command { | ||
return cli.Command{ | ||
Name: "forms", | ||
Aliases: []string{"fm"}, | ||
Usage: "Open Google Forms page", | ||
Flags: []cli.Flag{ | ||
cli.StringFlag{ | ||
Name: "query, q", | ||
Usage: "Query a page", | ||
}, | ||
cli.BoolFlag{ | ||
Name: "new, n", | ||
Usage: "Create a new form (this flag prioritize over query flag)", | ||
}, | ||
}, | ||
Action: func(c *cli.Context) error { | ||
g, err := googleworkspace.GetProvider() | ||
if err != nil { | ||
return err | ||
} | ||
return browser.Open(c, g) | ||
}, | ||
} | ||
|
||
} |
This file contains 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
Oops, something went wrong.