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

Add status command #2

Closed
Reinmar opened this issue Jan 12, 2017 · 7 comments · Fixed by #54
Closed

Add status command #2

Reinmar opened this issue Jan 12, 2017 · 7 comments · Fixed by #54

Comments

@Reinmar
Copy link
Member

Reinmar commented Jan 12, 2017

Should pretty-print the statuses of all repos.

We need to figure out which information are the most important and a nice way to print them (some sort of a table?).

@Reinmar
Copy link
Member Author

Reinmar commented Jun 28, 2017

I'm missing this command quite badly. I'm using mgit exec 'git st' but it's hard to read when you have 20 repos.

I'd like this command to print a table with the following info:

  1. package name,
  2. branch name || detached,
  3. hash,
  4. short status about changes – modified files, files added to the indes, new files,
  5. info: ahead/behind/on branch.

How nodeprompt does it is really good. All important information is present and proper colors are used to make it even easier to read.

@oleq
Copy link
Member

oleq commented Jul 31, 2017

These are the command that I use when working with branch constellations:

mgit exec 'git status | grep "not staged" && git st'
mgit exec 'git status | grep "not staged" && git diff'
mgit exec 'git status | grep "On branch t/" && echo $PWD'

@Reinmar
Copy link
Member Author

Reinmar commented Jul 31, 2017

I wonder which of these we could:

  • include in mgit st options,
  • for which we could've some configurable shortcuts in mgit exec,
  • and which deserve their new commands.

I'd say that:

1.

mgit exec 'git status | grep "not staged" && git st'

Could become:

  • mgit st --modified – prints a table only repos with any changes (includes not staged and untracked files) .
  • mgit st --details – prints a table but with a column called "Details" that would contain a list of untracked and modified files.

2.

mgit exec 'git status | grep "not staged" && git diff'

Could become mgit diff.

The --modified command is not needed here because by default we should only print repos where there were any changes.

The important thing here is that we should not lose colors. AFAIK the way we execute commands on multiple repos now means that we lose the colors and we'd need to completely change that bit of the code. Since this method proved to be really stable, I wouldn't like that. So, if there's no other option, that command would need to work like this:

  1. retrieve statuses of all repos using the concurrent command execution,
  2. check which changed and get diffs for only this repo without involving concurrency.

After all, usually you'll have any changes in just a few repos.

However, I'd really check if we can't preserve colors without changing the execution method.

3.

mgit exec 'git status | grep "On branch t/" && echo $PWD'

This will be really well visible in mgit st. Repos which are not on master or major could be marked in some way – maybe slightly highlighted?

@oleq, WDYT?

@pomek pomek self-assigned this Jul 31, 2017
@pomek
Copy link
Member

pomek commented Aug 2, 2017

Status of the mgit status command:

image

The status command is available as st.

A pink row means – branch in the package is other than defined in mgit.json. Other symbols are explained in the Legend.

Thanks @oleq for help to polish the table.

@pomek
Copy link
Member

pomek commented Aug 3, 2017

Status of the mgit diff command:

  • For diff command we don't display the counter in repository bar:

image

  • By default we display changes (not staged) from all repositories:

image

image

  • even more:

image

  • We can pass options directly to the diff command:

image

  • These options can be defined even if some options for mgit was set:

image

  • When there are no changes, nothing will be displayed:

image

  • but if we add changes to staged…

image

So basically, we can use mgit diff as an alias of mgit exec 'git diff' what was the main goal for this command.

@pomek
Copy link
Member

pomek commented Aug 3, 2017

After all, I executed mgit st which prints:

image

@Reinmar
Copy link
Member Author

Reinmar commented Aug 4, 2017

Wow, amazing work on these commands. I really like every bit of them. Great job!

Reinmar added a commit that referenced this issue Aug 16, 2017
Feature: Introduced new commands and fixes bugs related to invalid displayed errors. Closes #2. Closes #45. Closes #49. Closes #52.

- New commands:
  * `checkout` – changes branches in repositories according to the configuration file (see #52),
  * `diff` – prints changes from all repositories (see #2),
  * `status` – prints a table which contains useful information about the status of repositories (see #2).
- Bug fixes:
  * known errors should not be logged as crashes (see #45),
  * fixed `Unhandled promise` error (see #49).
- Added support for aliases (`st` => `status`, `co` => `checkout`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants