{"action":"created","issue":{"url":"https://api.github.com/repos/stedolan/jq/issues/974","labels_url":"https://api.github.com/repos/stedolan/jq/issues/974/labels{/name}","comments_url":"https://api.github.com/repos/stedolan/jq/issues/974/comments","events_url":"https://api.github.com/repos/stedolan/jq/issues/974/events","html_url":"https://github.com/stedolan/jq/issues/974","id":109662501,"number":974,"title":"Enhancement request: specify flags in script file","user":{"login":"markjreed","id":361055,"avatar_url":"https://avatars.githubusercontent.com/u/361055?v=3","gravatar_id":"","url":"https://api.github.com/users/markjreed","html_url":"https://github.com/markjreed","followers_url":"https://api.github.com/users/markjreed/followers","following_url":"https://api.github.com/users/markjreed/following{/other_user}","gists_url":"https://api.github.com/users/markjreed/gists{/gist_id}","starred_url":"https://api.github.com/users/markjreed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markjreed/subscriptions","organizations_url":"https://api.github.com/users/markjreed/orgs","repos_url":"https://api.github.com/users/markjreed/repos","events_url":"https://api.github.com/users/markjreed/events{/privacy}","received_events_url":"https://api.github.com/users/markjreed/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/stedolan/jq/labels/feature%20request","name":"feature request","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-10-04T04:25:02Z","updated_at":"2015-10-06T22:04:44Z","closed_at":null,"body":"It would be useful if a script file (to be read via `jq -f`) had a way of specifying that it should be run with other command-line options.  For example, it might be written to assume slurp mode, so it would be nice if it could indicate that somehow - perhaps similar to the way Perl will look for and honor flags in the shebang line even if not executed via exec(). \r\n\r\nOf course you could just make it a shell script, but then the jq file is not itself portable between windows and unix."},"comment":{"url":"https://api.github.com/repos/stedolan/jq/issues/comments/146015929","html_url":"https://github.com/stedolan/jq/issues/974#issuecomment-146015929","issue_url":"https://api.github.com/repos/stedolan/jq/issues/974","id":146015929,"user":{"login":"nicowilliams","id":604851,"avatar_url":"https://avatars.githubusercontent.com/u/604851?v=3","gravatar_id":"","url":"https://api.github.com/users/nicowilliams","html_url":"https://github.com/nicowilliams","followers_url":"https://api.github.com/users/nicowilliams/followers","following_url":"https://api.github.com/users/nicowilliams/following{/other_user}","gists_url":"https://api.github.com/users/nicowilliams/gists{/gist_id}","starred_url":"https://api.github.com/users/nicowilliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicowilliams/subscriptions","organizations_url":"https://api.github.com/users/nicowilliams/orgs","repos_url":"https://api.github.com/users/nicowilliams/repos","events_url":"https://api.github.com/users/nicowilliams/events{/privacy}","received_events_url":"https://api.github.com/users/nicowilliams/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T22:04:44Z","updated_at":"2015-10-06T22:04:44Z","body":"The fundamental issue is that \"raw input\" doesn't mean \"not JSON text input\", but it does mean \"string input at the VM layer, and `-n` doesn't mean \"won't read from stdin\", just that the processor shouldn't, and so on.  The command-line options hide these details, but don't do it well.  Another thing is that a jq program might want input in a given schema or format (csv, tsv, ...), but right now there's no way to communicate this to a user other than via documentation.\r\n\r\nSuppose you have a program that wants an array of objects.  The user might have a sequence of them, so they should use `-s`, or they could tell the program \"the input is a stream of objects\" and let the program slurp them with `[.,inputs]`, the jq program could act differently depending on whether the input was slurped or not, if only the jq program could know.\r\n\r\nHow to deal with this?  I think we could have the program document what it wants and the processor / user tell it what it's getting, and then the VM and/or program can do its best whatever that means.  But this doesn't sound simple or pleasant unless we provide builtins that implement common impedance matching tasks."}}