Skip to content

Conversation

@mcarmonaa
Copy link
Contributor

This it the borges command organization now:

Usage:
  borges [OPTIONS] <command>

Fetches, organizes and stores repositories.

Help Options:
  -h, --help  Show this help message

Available commands:
  consumer  consume jobs from a queue and process them
  init      initialize the database schema
  pack      quickly pack remote or local repositories into siva files
  producer  create new jobs and put them into the queue
  version   print version

The producer command has been split in several subcommands:

Usage:
  borges [OPTIONS] producer <command>

Help Options:
  -h, --help      Show this help message

Available commands:
  file       produce jobs from file
  mentions   produce jobs from mentions
  republish  requeue jobs from buried queues
  update     update repositories processed previously

About the code, each command is in its own file and it's added to the global parser by the func init() in that file, making easier aggregate more commands.

The subcommands are in their own files too, but the addition is handled in the func init() of the command parent.

The functionality of the commands republish and update aren't implemented in this PR.

Closes #244

@mcarmonaa mcarmonaa force-pushed the improvement/producer-command-organization branch from 25fbf9f to 16a9f56 Compare April 12, 2018 10:42
@ajnavarro
Copy link
Contributor

If republish and update are not implemented, delete them.

@mcarmonaa
Copy link
Contributor Author

@ajnavarro there are PRs implementing that functionality #250 #249, just left the structure to make easier the integration with that code. Should I remove them anyway?

@ajnavarro
Copy link
Contributor

Yes, I would prefer to add that structure on the other PRs with the actual functionality.

Execute(args []string) error
}

type Commander interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why commander and not just Command?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw in the go-flags library that name too, but yes, Command and ExecutableCommand looks better. Will change that.

return nil
}

func init() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd prefer initializing the commands in the main as it was before instead of having the initializations scattered across all files and sharing a global parser, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer that each command adds itself and don't have an enormous main but whatever all of you agree it's ok for me.


const (
fileCmdName = "file"
fileCmdShortName = "produce jobs from file"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be fileCmdShortDesc?


const (
mentionsCmdName = "mentions"
mentionsCmdShortName = "produce jobs from mentions"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mentionsCmdShortDesc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, changing it..

@mcarmonaa mcarmonaa force-pushed the improvement/producer-command-organization branch from 7d150e6 to b5fe323 Compare April 17, 2018 09:31
Signed-off-by: Manuel Carmona <manu.carmona90@gmail.com>
Signed-off-by: Manuel Carmona <manu.carmona90@gmail.com>
Signed-off-by: Manuel Carmona <manu.carmona90@gmail.com>
…mmand

Signed-off-by: Manuel Carmona <manu.carmona90@gmail.com>
@mcarmonaa mcarmonaa force-pushed the improvement/producer-command-organization branch from b5fe323 to d47ce6e Compare April 20, 2018 14:16
@mcarmonaa mcarmonaa merged commit 7b26439 into src-d:master Apr 20, 2018
@mcarmonaa mcarmonaa deleted the improvement/producer-command-organization branch April 20, 2018 14:37
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

Successfully merging this pull request may close these issues.

4 participants