Example #1
0
func NewApp() *App {

	this := &App{}
	app := cli.NewApp()
	app.Name = "talkie"
	app.Usage = "Secure voicing messaging for geeks"
	app.Action = func(c *cli.Context) {
		// default
		this.list(c)
	}
	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:  "server",
			Value: "130.211.156.226:3333",
		},
	}
	app.Version = Version
	app.Author = Author
	app.Email = Email
	app.Commands = []cli.Command{
		NewListCommand(this),
		NewSendCommand(this),
		// NewPlayCommand(this),
		// NewDeleteCommand(this),
	}

	os.MkdirAll(path.Join(os.Getenv("HOME"), ".talkie"), 0750)

	this.app = app
	this.store = common.NewStoreSqlite(&common.SqliteStoreOptions{
		DBPath: path.Join(os.Getenv("HOME"), ".talkie", "talkie.db"),
	})
	this.maxDuration = DefaultMaxDuration
	this.config, _ = this.loadConfig()

	return this
}
func init() {
	os.MkdirAll(path.Join(os.Getenv("HOME"), ".talkie"), 0755)
	store = common.NewStoreSqlite(&common.SqliteStoreOptions{
		DBPath: path.Join(os.Getenv("HOME"), ".talkie", "talkie.db"),
	})
}