Skip to content

Add interactive option #1

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AlahmadiQ8
Copy link

  • add 'commander' package to manage args parsing.
  • add -i --interactive option to select branches with fuzzy search.
  ├── src
A │   └── interactive.js
M ├── main.js
M ├── package.json
A └── yarn.lock

@Bates550
Copy link
Owner

Is the lockfile something I want to add? I ask out of ignorance

@AlahmadiQ8
Copy link
Author

no. I just removed it.

  ├── src
A │   └── interactive.js
M ├── main.js
M └── package.json

@Bates550
Copy link
Owner

Bates550 commented Oct 2, 2017

diff-tree-interactive
It's interesting, but a little confusing that master, origin/master, and remotes/origin/master show up in interactive mode. I'm not entirely sure what remotes/origin/master even is.

Do you think it makes sense to filter out remote tracking branches and whatever remotes/origin/master is?

@Bates550
Copy link
Owner

Bates550 commented Oct 2, 2017

diff-tree -i was not giving me any changes when diff-tree was. I logged the interactive answers and the changes with this code to get the screenshot following the code.

/* main.js */
const execDiffandDrawTree = (branchA, branchB) => {
  exec(`git diff --name-status ${branchA}...${branchB}`, (err, stdout, stderr) => {
    const changes = diffStrToChanges(stdout);
    const treeData = tree(changes);
    console.log('changes', changes); // LOGGING
    console.log(drawTree(treeData));
  });
};

/* src/interactive.js */
module.exports = (cb) => {
  inquirer.prompt([
    ...
  ]).then(function(answers) {
    const { diffAgainstBranch, targetBranch} = answers;
    console.log('answers', answers); // LOGGING
    cb(diffAgainstBranch, targetBranch);
  })
}

branchesweirdonlinux

I am running on Linux. That might be part of it. I'll investigate.

@Bates550
Copy link
Owner

Bates550 commented Oct 2, 2017

I found a bug where if you try to fuzzy search for a branch then delete your fuzzy search, it shows a list of undefined. The other text in there was me console logging stuff.
screenshot from 2017-10-01 17-36-12

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

Successfully merging this pull request may close these issues.

2 participants