-
Notifications
You must be signed in to change notification settings - Fork 171
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 #4 from graniet/version-beta
Version beta
- Loading branch information
Showing
16 changed files
with
560 additions
and
15 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
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
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,61 @@ | ||
package follower_to_screenName | ||
|
||
import ( | ||
"github.com/ChimeraCoder/anaconda" | ||
"github.com/graniet/go-pretty/table" | ||
"github.com/graniet/operative-framework/session" | ||
"net/url" | ||
"os" | ||
"strconv" | ||
) | ||
|
||
type FollowerScreenName struct{ | ||
session.SessionFilter | ||
Sess *session.Session | ||
} | ||
|
||
func PushFollowerScreenNameFilter(s *session.Session) *FollowerScreenName{ | ||
mod := FollowerScreenName{ | ||
Sess: s, | ||
} | ||
mod.AddModule("twitter_followers") | ||
return &mod | ||
} | ||
|
||
func (filter *FollowerScreenName) Name() string{ | ||
return "follower_to_screen" | ||
} | ||
|
||
func (filter *FollowerScreenName) Description() string{ | ||
return "Find screen name from twitter ID list" | ||
} | ||
|
||
func (filter *FollowerScreenName) Author() string{ | ||
return "Tristan Granier" | ||
} | ||
|
||
func (filter *FollowerScreenName) Start(mod session.Module){ | ||
api := anaconda.NewTwitterApiWithCredentials(filter.Sess.Config.Twitter.Password, filter.Sess.Config.Twitter.Api.SKey, filter.Sess.Config.Twitter.Login, filter.Sess.Config.Twitter.Api.Key) | ||
v := url.Values{} | ||
|
||
t := filter.Sess.Stream.GenerateTable() | ||
t.SetOutputMirror(os.Stdout) | ||
t.AppendHeader(table.Row{ | ||
"id", | ||
"screen_name", | ||
}) | ||
for _, id := range mod.GetResults(){ | ||
id64, err := strconv.ParseInt(id, 10, 64) | ||
if err == nil { | ||
user, errU := api.GetUsersShowById(id64,v) | ||
if errU == nil{ | ||
t.AppendRow(table.Row{ | ||
id, | ||
user.ScreenName, | ||
|
||
}) | ||
} | ||
} | ||
} | ||
filter.Sess.Stream.Render(t) | ||
} |
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,61 @@ | ||
package diagram | ||
|
||
import ( | ||
"fmt" | ||
"github.com/awalterschulze/gographviz" | ||
"github.com/graniet/operative-framework/session" | ||
) | ||
|
||
type DiagramModule struct{ | ||
session.SessionModule | ||
sess *session.Session | ||
Stream *session.Stream | ||
} | ||
|
||
func PushDiagramModuleRetrieval(s *session.Session) *DiagramModule{ | ||
mod := DiagramModule{ | ||
sess: s, | ||
Stream: &s.Stream, | ||
} | ||
return &mod | ||
} | ||
|
||
func (module *DiagramModule) Name() string{ | ||
return "diagram" | ||
} | ||
|
||
func (module *DiagramModule) Author() string{ | ||
return "Tristan Granier" | ||
} | ||
|
||
func (module *DiagramModule) Description() string{ | ||
return "Generate a diagram of project" | ||
} | ||
|
||
func (module *DiagramModule) GetType() string{ | ||
return "" | ||
} | ||
|
||
func (module *DiagramModule) GetInformation() session.ModuleInformation{ | ||
information := session.ModuleInformation{ | ||
Name: module.Name(), | ||
Description: module.Description(), | ||
Author: module.Author(), | ||
Type: module.GetType(), | ||
Parameters: module.Parameters, | ||
} | ||
return information | ||
} | ||
|
||
func (module *DiagramModule) Start(){ | ||
graphAst, _ := gographviz.ParseString(`digraph Project {}`) | ||
graph := gographviz.NewGraph() | ||
if err := gographviz.Analyse(graphAst, graph); err != nil { | ||
panic(err) | ||
} | ||
_ = graph.AddNode("Project", "a", nil) | ||
_ = graph.AddNode("Project", "b", nil) | ||
_ = graph.AddEdge("a", "b", true, nil) | ||
output := graph.String() | ||
fmt.Println(output) | ||
} |
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
Oops, something went wrong.