{"action":"created","issue":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2383","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2383/labels{/name}","comments_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2383/comments","events_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2383/events","html_url":"https://github.com/fish-shell/fish-shell/pull/2383","id":106117810,"number":2383,"title":"add function to autoload functions and completions","user":{"login":"bucaran","id":8317250,"avatar_url":"https://avatars.githubusercontent.com/u/8317250?v=3","gravatar_id":"","url":"https://api.github.com/users/bucaran","html_url":"https://github.com/bucaran","followers_url":"https://api.github.com/users/bucaran/followers","following_url":"https://api.github.com/users/bucaran/following{/other_user}","gists_url":"https://api.github.com/users/bucaran/gists{/gist_id}","starred_url":"https://api.github.com/users/bucaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bucaran/subscriptions","organizations_url":"https://api.github.com/users/bucaran/orgs","repos_url":"https://api.github.com/users/bucaran/repos","events_url":"https://api.github.com/users/bucaran/events{/privacy}","received_events_url":"https://api.github.com/users/bucaran/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-12T00:58:49Z","updated_at":"2015-09-14T21:48:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/fish-shell/fish-shell/pulls/2383","html_url":"https://github.com/fish-shell/fish-shell/pull/2383","diff_url":"https://github.com/fish-shell/fish-shell/pull/2383.diff","patch_url":"https://github.com/fish-shell/fish-shell/pull/2383.patch"},"body":"#### `auto <path> [<path>...]`\r\n\r\n```\r\n  auto -- autoload functions and completions\r\n\r\n  Synopsis\r\n    auto <path> [<path>...]\r\n\r\n  Description\r\n    Add the specified list of directories to $fish_function_path\r\n    or $fish_complete_path.\r\n```\r\n\r\nI always find myself appending to `$fish_function_path` and `$fish_complete_path` and I think it would be useful, specially to folks writing fish “frameworks” to have a standard function we can all benefit from.\r\n\r\n\r\n```fish\r\nauto {$my_home,$my_custom}/stuff\r\n```\r\n\r\n\r\nIn the original Oh My Fish! we had a somewhat similar set of `_append` and `_prepend` bulky ones which we later improved in Wahoo. The current OMF uses a similar version to this one based in Wahoo and the new project I am working on uses this exact one, but it would be much nicer if fish just gave it to us :smile: \r\n\r\nThis function could also be a “plumbing” function `__fish_auto`. Other name suggestions:\r\n\r\n+ funcauto\r\n+ autoload\r\n+ __fish_add_path\r\n+ Add as an extra option to `functions --add` or `funcsave --path`?\r\n\r\nThis PR contains a function I decided to name `auto` for lack of a cooler name. Feel free to suggest better alternatives."},"comment":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/comments/140215010","html_url":"https://github.com/fish-shell/fish-shell/pull/2383#issuecomment-140215010","issue_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2383","id":140215010,"user":{"login":"faho","id":5185367,"avatar_url":"https://avatars.githubusercontent.com/u/5185367?v=3","gravatar_id":"","url":"https://api.github.com/users/faho","html_url":"https://github.com/faho","followers_url":"https://api.github.com/users/faho/followers","following_url":"https://api.github.com/users/faho/following{/other_user}","gists_url":"https://api.github.com/users/faho/gists{/gist_id}","starred_url":"https://api.github.com/users/faho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faho/subscriptions","organizations_url":"https://api.github.com/users/faho/orgs","repos_url":"https://api.github.com/users/faho/repos","events_url":"https://api.github.com/users/faho/events{/privacy}","received_events_url":"https://api.github.com/users/faho/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T21:48:45Z","updated_at":"2015-09-14T21:48:45Z","body":"Humm... this seems rather specific. Wouldn't this be better solved with an option to `set` to append something to a variable only if it's not included yet?\r\n\r\nThen you could do \r\n\r\n```fish\r\nset --append-once fish_function_path {$my_home,$my_custom}/stuff\r\nset --append-once fish_complete_path {$my_home,$my_custom}/stuff\r\n```\r\n\r\n(We also have a request for a general append option, which is why I used \"--append-once\", though that's certainly not the absolute best name - then again I also thought of \"--append-if-not-included\", which might be a tad on the long side)"}}