{"action":"created","issue":{"url":"https://api.github.com/repos/rupa/z/issues/158","labels_url":"https://api.github.com/repos/rupa/z/issues/158/labels{/name}","comments_url":"https://api.github.com/repos/rupa/z/issues/158/comments","events_url":"https://api.github.com/repos/rupa/z/issues/158/events","html_url":"https://github.com/rupa/z/issues/158","id":101093671,"number":158,"title":"Match priority","user":{"login":"kaelzhang","id":352304,"avatar_url":"https://avatars.githubusercontent.com/u/352304?v=3","gravatar_id":"","url":"https://api.github.com/users/kaelzhang","html_url":"https://github.com/kaelzhang","followers_url":"https://api.github.com/users/kaelzhang/followers","following_url":"https://api.github.com/users/kaelzhang/following{/other_user}","gists_url":"https://api.github.com/users/kaelzhang/gists{/gist_id}","starred_url":"https://api.github.com/users/kaelzhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaelzhang/subscriptions","organizations_url":"https://api.github.com/users/kaelzhang/orgs","repos_url":"https://api.github.com/users/kaelzhang/repos","events_url":"https://api.github.com/users/kaelzhang/events{/privacy}","received_events_url":"https://api.github.com/users/kaelzhang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-08-14T20:08:03Z","updated_at":"2016-01-05T19:51:24Z","closed_at":null,"body":"## Prefer to match a whole word\r\n```\r\n/path/to/redirect 100\r\n/path/to/red 10\r\n```\r\n\r\nproposal:\r\n```sh\r\n$ z red\r\n$ pwd\r\n/path/to/red\r\n```\r\n\r\n## Match from right to left\r\n```\r\n/path/to/node/abc 100\r\n/path/to/node 10\r\n```\r\n\r\nproposal:\r\n```sh\r\n$ z node\r\n$ pwd\r\n/path/to/node\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/rupa/z/issues/comments/169110314","html_url":"https://github.com/rupa/z/issues/158#issuecomment-169110314","issue_url":"https://api.github.com/repos/rupa/z/issues/158","id":169110314,"user":{"login":"rupa","id":46809,"avatar_url":"https://avatars.githubusercontent.com/u/46809?v=3","gravatar_id":"","url":"https://api.github.com/users/rupa","html_url":"https://github.com/rupa","followers_url":"https://api.github.com/users/rupa/followers","following_url":"https://api.github.com/users/rupa/following{/other_user}","gists_url":"https://api.github.com/users/rupa/gists{/gist_id}","starred_url":"https://api.github.com/users/rupa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rupa/subscriptions","organizations_url":"https://api.github.com/users/rupa/orgs","repos_url":"https://api.github.com/users/rupa/repos","events_url":"https://api.github.com/users/rupa/events{/privacy}","received_events_url":"https://api.github.com/users/rupa/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T19:51:24Z","updated_at":"2016-01-05T19:51:24Z","body":"I'll add a bit more to this discussion, I guess.\r\n\r\nI (mildly) don't like the idea of weighting full words over partials - mainly because it adds complexity to my mental model of what the algorithm is going to do. To be fair, because I wrote this, I probably have a more nuanced idea of it than most - but, I think it's basically very simple (I even begrudge the \"common hack\" for adding complexity, even though it's necessary). The simpler the algorithm the less I have to think about my usage. \r\n\r\nrecap of the algorithm:\r\n\r\n* return the highest weighted path matching all the arguments in order, UNLESS\r\n* one of the matches is wholly contained in ALL of the other matches, in which case, return that.\r\n\r\nSimple, nudges you toward using uniquish identifiers near the end of the path you're thinking of, easy to reason about in advance, easy to adjust if you end up somewhere unexpected."}}