{"action":"closed","issue":{"url":"https://api.github.com/repos/tokozedg/sman/issues/6","repository_url":"https://api.github.com/repos/tokozedg/sman","labels_url":"https://api.github.com/repos/tokozedg/sman/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/tokozedg/sman/issues/6/comments","events_url":"https://api.github.com/repos/tokozedg/sman/issues/6/events","html_url":"https://github.com/tokozedg/sman/issues/6","id":160803174,"number":6,"title":"sman ls doesn't show snippets if the command is located in a separate file","user":{"login":"aviadpines","id":775521,"avatar_url":"https://avatars.githubusercontent.com/u/775521?v=3","gravatar_id":"","url":"https://api.github.com/users/aviadpines","html_url":"https://github.com/aviadpines","followers_url":"https://api.github.com/users/aviadpines/followers","following_url":"https://api.github.com/users/aviadpines/following{/other_user}","gists_url":"https://api.github.com/users/aviadpines/gists{/gist_id}","starred_url":"https://api.github.com/users/aviadpines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aviadpines/subscriptions","organizations_url":"https://api.github.com/users/aviadpines/orgs","repos_url":"https://api.github.com/users/aviadpines/repos","events_url":"https://api.github.com/users/aviadpines/events{/privacy}","received_events_url":"https://api.github.com/users/aviadpines/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-17T03:03:25Z","updated_at":"2016-06-17T23:41:53Z","closed_at":"2016-06-17T23:41:53Z","body":"When typing `s ls` snippets that have commands located in a different files are not shown. For example, taken from the example snippets:\r\n```\r\n$ s ls\r\nshell:\r\n   alias:add             [----]                   Add Alias And Reload Rc\r\n   curl:ip               [----]                   My External Ip\r\n   curl:upload           [----]                   Encrypt File And Upload To Transfer.Sh\r\n   mount:ram             [----]                   Mount Ram As File System\r\n   ngrep:port            [----]                   Ngrep To Port\r\n   sed:replace           [----]                   Replace String In All Files\r\n   service:disable       [Ubuntu]                 Disable Service On Ubuntu\r\n   service:status        [Centos]                 List All Services\r\n   smtp:server           [----]                   Smtp Server In Python. Prints Mails To Stdout\r\n   tar:file              [----]                   Create A Gzipped Archive\r\n   tcpdump:port          [----]                   Listen Traffic On Port\r\n   user:group            [----]                   Add User To Group\r\n```\r\n\r\nThe commands `for:file` and `sshconfig:add` are not shown even though exist:\r\n```\r\n# shell.yml:22\r\n sshconfig:add:\r\n   do: exec\r\n   desc: add new machine to ssh config\r\n\r\n# shell.yml:64\r\nfor:file:\r\n  do: exec\r\n  desc: recursive for file loop\r\n```\r\n\r\nProblem resides in `sman/lib/snippet.go` line 83:\r\n`c, _ := ioutil.ReadFile(dir + s.File + \"/\" + s.Name)`\r\n\r\nBetween `dir` and `s.File` there is no slash, resulting that with the default parameters you get (example from my machine):\r\n\r\n`/home/vagrant/snippetsshell/for:file ` instead of `/home/vagrant/snippets/shell/for:file `\r\n\r\nadding a `/` in line 83 solves the problem:\r\n\r\n` c, _ := ioutil.ReadFile(dir + \"/\" +  s.File + \"/\" + s.Name)`\r\n\r\n```\r\n$ s ls\r\nshell:\r\n   alias:add             [----]                   Add Alias And Reload Rc\r\n   curl:ip               [----]                   My External Ip\r\n   curl:upload           [----]                   Encrypt File And Upload To Transfer.Sh\r\n   for:file              [----]                   Recursive For File Loop\r\n   mount:ram             [----]                   Mount Ram As File System\r\n   ngrep:port            [----]                   Ngrep To Port\r\n   sed:replace           [----]                   Replace String In All Files\r\n   service:disable       [Ubuntu]                 Disable Service On Ubuntu\r\n   service:status        [Centos]                 List All Services\r\n   smtp:server           [----]                   Smtp Server In Python. Prints Mails To Stdout\r\n   sshconfig:add         [----]                   Add New Machine To Ssh Config\r\n   tar:file              [----]                   Create A Gzipped Archive\r\n   tcpdump:port          [----]                   Listen Traffic On Port\r\n   user:group            [----]                   Add User To Group\r\n```\r\n\r\n\r\n"}}
{"actor":{"display_login":"tokozedg"}}