-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for GitHub, Docker Hub, and Stack Overflow
- Loading branch information
Showing
5 changed files
with
67 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ import ( | |
|
||
const ( | ||
appName = "s" | ||
version = "0.1.2" | ||
version = "0.1.3" | ||
) | ||
|
||
// Flag variables | ||
|
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,21 @@ | ||
package dockerhub | ||
|
||
import ( | ||
"fmt" | ||
"net/url" | ||
|
||
"github.com/zquestz/s/providers" | ||
) | ||
|
||
func init() { | ||
providers.AddProvider("dockerhub", &DockerHubProvider{}) | ||
} | ||
|
||
// DockerHubProvider adheres to the Provider interface. | ||
type DockerHubProvider struct { | ||
} | ||
|
||
// BuildURI generates a search URL for Docker Hub. | ||
func (p *DockerHubProvider) BuildURI(q string) string { | ||
return fmt.Sprintf("https://hub.docker.com/search/?q=%s", url.QueryEscape(q)) | ||
} |
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,21 @@ | ||
package github | ||
|
||
import ( | ||
"fmt" | ||
"net/url" | ||
|
||
"github.com/zquestz/s/providers" | ||
) | ||
|
||
func init() { | ||
providers.AddProvider("github", &GitHubProvider{}) | ||
} | ||
|
||
// GitHubProvider adheres to the Provider interface. | ||
type GitHubProvider struct { | ||
} | ||
|
||
// BuildURI generates a search URL for GitHub. | ||
func (p *GitHubProvider) BuildURI(q string) string { | ||
return fmt.Sprintf("https://github.com/search?utf8=✓&q=%s", url.QueryEscape(q)) | ||
} |
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,21 @@ | ||
package stackoverflow | ||
|
||
import ( | ||
"fmt" | ||
"net/url" | ||
|
||
"github.com/zquestz/s/providers" | ||
) | ||
|
||
func init() { | ||
providers.AddProvider("stackoverflow", &StackOverflowProvider{}) | ||
} | ||
|
||
// StackOverflowProvider adheres to the Provider interface. | ||
type StackOverflowProvider struct { | ||
} | ||
|
||
// BuildURI generates a search URL for Stack Overflow. | ||
func (p *StackOverflowProvider) BuildURI(q string) string { | ||
return fmt.Sprintf("http://stackoverflow.com/search?q=%s", url.QueryEscape(q)) | ||
} |
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