{"action":"created","issue":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/9513","repository_url":"https://api.github.com/repos/nim-lang/Nim","labels_url":"https://api.github.com/repos/nim-lang/Nim/issues/9513/labels{/name}","comments_url":"https://api.github.com/repos/nim-lang/Nim/issues/9513/comments","events_url":"https://api.github.com/repos/nim-lang/Nim/issues/9513/events","html_url":"https://github.com/nim-lang/Nim/issues/9513","id":373937463,"node_id":"MDU6SXNzdWUzNzM5Mzc0NjM=","number":9513,"title":"we need an --outputdir switch","user":{"login":"timotheecour","id":2194784,"node_id":"MDQ6VXNlcjIxOTQ3ODQ=","avatar_url":"https://avatars2.githubusercontent.com/u/2194784?v=4","gravatar_id":"","url":"https://api.github.com/users/timotheecour","html_url":"https://github.com/timotheecour","followers_url":"https://api.github.com/users/timotheecour/followers","following_url":"https://api.github.com/users/timotheecour/following{/other_user}","gists_url":"https://api.github.com/users/timotheecour/gists{/gist_id}","starred_url":"https://api.github.com/users/timotheecour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timotheecour/subscriptions","organizations_url":"https://api.github.com/users/timotheecour/orgs","repos_url":"https://api.github.com/users/timotheecour/repos","events_url":"https://api.github.com/users/timotheecour/events{/privacy}","received_events_url":"https://api.github.com/users/timotheecour/received_events","type":"User","site_admin":false},"labels":[{"id":32256242,"node_id":"MDU6TGFiZWwzMjI1NjI0Mg==","url":"https://api.github.com/repos/nim-lang/Nim/labels/RFC","name":"RFC","color":"1d1d1d","default":false},{"id":1104243899,"node_id":"MDU6TGFiZWwxMTA0MjQzODk5","url":"https://api.github.com/repos/nim-lang/Nim/labels/command%20line","name":"command line","color":"94d800","default":false}],"state":"open","locked":false,"assignee":{"login":"timotheecour","id":2194784,"node_id":"MDQ6VXNlcjIxOTQ3ODQ=","avatar_url":"https://avatars2.githubusercontent.com/u/2194784?v=4","gravatar_id":"","url":"https://api.github.com/users/timotheecour","html_url":"https://github.com/timotheecour","followers_url":"https://api.github.com/users/timotheecour/followers","following_url":"https://api.github.com/users/timotheecour/following{/other_user}","gists_url":"https://api.github.com/users/timotheecour/gists{/gist_id}","starred_url":"https://api.github.com/users/timotheecour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timotheecour/subscriptions","organizations_url":"https://api.github.com/users/timotheecour/orgs","repos_url":"https://api.github.com/users/timotheecour/repos","events_url":"https://api.github.com/users/timotheecour/events{/privacy}","received_events_url":"https://api.github.com/users/timotheecour/received_events","type":"User","site_admin":false},"assignees":[{"login":"timotheecour","id":2194784,"node_id":"MDQ6VXNlcjIxOTQ3ODQ=","avatar_url":"https://avatars2.githubusercontent.com/u/2194784?v=4","gravatar_id":"","url":"https://api.github.com/users/timotheecour","html_url":"https://github.com/timotheecour","followers_url":"https://api.github.com/users/timotheecour/followers","following_url":"https://api.github.com/users/timotheecour/following{/other_user}","gists_url":"https://api.github.com/users/timotheecour/gists{/gist_id}","starred_url":"https://api.github.com/users/timotheecour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timotheecour/subscriptions","organizations_url":"https://api.github.com/users/timotheecour/orgs","repos_url":"https://api.github.com/users/timotheecour/repos","events_url":"https://api.github.com/users/timotheecour/events{/privacy}","received_events_url":"https://api.github.com/users/timotheecour/received_events","type":"User","site_admin":false}],"milestone":null,"comments":11,"created_at":"2018-10-25T13:05:46Z","updated_at":"2018-12-11T22:10:49Z","closed_at":null,"author_association":"COLLABORATOR","body":"## originally proposed here: \r\nhttps://gitter.im/nim-lang/Nim?at=5bd1bd6e271506518d6a6ff0\r\n\r\n## proposal\r\n`nim c —outputdir:bin bar.nim` => outputs to `bin/bar` \r\n\r\nit has 0 ambiguity (unless other schemes like infering whether argument to `-o` \"looks like a dir\", these are fragile)\r\n\r\nwith it we can add `—outputdir:build` in nim.cfg (or `switch(“outputdir”, “build”)` in top-level project config.nims , and then it makes it really easy to conform to a `build` dir (see https://forum.nim-lang.org/t/4330 : \"nimble packages should standardize on a `build` directory for generated files\" )\r\n\r\n* it avoids need to gitignore specific files\r\n* it allows putting generated files all in 1 place without custom complex setup in each nimble project\r\n* FWIW in D they have introduced this flag `-od` with roughly same meaning\r\n\r\n## normal + edge cases\r\n```\r\n--outputdir:foo --output:bar/zoo => outputs to foo/bar/zoo\r\n--outputdir:foo --output:/bar/zoo => outputs to /bar/zoo\r\n--outputdir:foo main.nim => outputs to foo/main\r\n--output:bar/zoo main.nim => outputs to bar/zoo\r\nfoo/main.nim => outputs to foo/main\r\n```\r\n\r\nnote: when `--outputdir=dir` is given in a config file (eg /pathtoCfg/nim.cfg or /pathtoCfg/config.nims), it is converted to an absolute path via `absolutePath(dir, /pathtoCfg/)` so that it's understood relative to where the outputdir is defined; this allows to simply write in your /pathtoCfg/config.nims (or similarly with nim.cfg):\r\nswitch(\"outputdir\", \"build\")\r\nand it'll build your binaries under /pathtoCfg/build/ independently of current dir where nim is run\r\n\r\n## algorithm\r\n```nim\r\nlet outputDefault = mainFile.splitFile.name\r\nlet binary = joinPath(outputdir = getCurrentDir(), output = outputDefault, absOverrides = true) # if 2nd arg is absolute, ignore 1st arg; as in PR https://github.com/nim-lang/Nim/pull/8351\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/comments/446381853","html_url":"https://github.com/nim-lang/Nim/issues/9513#issuecomment-446381853","issue_url":"https://api.github.com/repos/nim-lang/Nim/issues/9513","id":446381853,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NjM4MTg1Mw==","user":{"login":"timotheecour","id":2194784,"node_id":"MDQ6VXNlcjIxOTQ3ODQ=","avatar_url":"https://avatars2.githubusercontent.com/u/2194784?v=4","gravatar_id":"","url":"https://api.github.com/users/timotheecour","html_url":"https://github.com/timotheecour","followers_url":"https://api.github.com/users/timotheecour/followers","following_url":"https://api.github.com/users/timotheecour/following{/other_user}","gists_url":"https://api.github.com/users/timotheecour/gists{/gist_id}","starred_url":"https://api.github.com/users/timotheecour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timotheecour/subscriptions","organizations_url":"https://api.github.com/users/timotheecour/orgs","repos_url":"https://api.github.com/users/timotheecour/repos","events_url":"https://api.github.com/users/timotheecour/events{/privacy}","received_events_url":"https://api.github.com/users/timotheecour/received_events","type":"User","site_admin":false},"created_at":"2018-12-11T22:10:49Z","updated_at":"2018-12-11T22:10:49Z","author_association":"COLLABORATOR","body":"this was closed by mistake as I had mistakenly written `closes #9513` instead of `closes `closes #8196` in https://github.com/nim-lang/Nim/pull/9917 ; re-opening.\r\nbtw: I have a WIP on this, where I'm trying to see if supporting following syntax would be simpler instead of `--outputdir:foo` `--out:$outdir/'$exe' ; I'll explain more rationale + what I mean"}}
{"actor":{"display_login":"timotheecour"}}