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

Distinguish modified and untracked files in 'gr status' #74

Open
sergii-bond opened this issue Jun 21, 2017 · 2 comments
Open

Distinguish modified and untracked files in 'gr status' #74

sergii-bond opened this issue Jun 21, 2017 · 2 comments

Comments

@sergii-bond
Copy link

Currently gr status shows both modified and untracked files as 'modified'. It would be nice to know how many of those are actually untracked.

@sergii-bond
Copy link
Author

Here is the code snipped of status.js that after suggested modification:

        var n_modified = 0;
        var n_untracked = 0;

        for (i = 0; i < lines.length; i++) {
            if (/^M\s/.test(lines[i])) {
                n_modified++;
            } else {
                n_untracked++;
            }   
        }   

        var branchName = branchInfo.slice(3).split('.', 1)[0];

        console.log(
          style(dirname, 'gray') +
          style(path.basename(cwd), 'white') + pad(dirname + path.basename(cwd), pathMaxLen) + ' ' +
          branchName + pad(branchName, 15) + ' ' +
          style(n_modified, (n_modified > 0 ? 'red' : 'green')) + pad(n_modified, 14) +
          style(n_untracked, (n_untracked > 0 ? 'red' : 'green')) + pad(n_untracked, 14) +
          behind + pad(behind, 14) +
          tags.map(function(s) { return '@' + s; }).join(' ')
        );  

What I don't know is how to add a header to the output of 'gr status'.

@sergii-bond
Copy link
Author

Actually the code above needs enhancements to better distinguish between the codes returned by git status --porcelain.

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

1 participant