Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example #37

Open
wahmedswl opened this issue Oct 26, 2016 · 2 comments
Open

Example #37

wahmedswl opened this issue Oct 26, 2016 · 2 comments

Comments

@wahmedswl
Copy link

Hi,
Could you plz provide simple example where actual logic should be implemented. In the example given, if its been called with arguments eg

myservice install

will the later portion be called? It would be great if simple example would be provided that would allow all actions like install/start/stop etc just like in the provided example but simplified.

Thanks

@derkan
Copy link
Contributor

derkan commented Nov 24, 2016

Extending example at README:

....
	switch command {
	case "install":
		deleted := 0
		for i := range args {
		    j := i - deleted
		    if args[j] == "install" {
			args = args[:j+copy(args[j:], args[j+1:])]
			deleted++
		    }
		}
		return service.Install(args...)
....

And install service with:

myservice install -config x.ini

where config is read by your service with flag.String("config", "x.ini","Config file").

@maximus12793
Copy link
Contributor

yes can we add this to readme? It is not clear how install/start etc. all work when the only example is using an eventloop. I am trying to use this for a cron job and would be nice to have some more examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants