{"action":"created","issue":{"url":"https://api.github.com/repos/astefanutti/decktape/issues/130","repository_url":"https://api.github.com/repos/astefanutti/decktape","labels_url":"https://api.github.com/repos/astefanutti/decktape/issues/130/labels{/name}","comments_url":"https://api.github.com/repos/astefanutti/decktape/issues/130/comments","events_url":"https://api.github.com/repos/astefanutti/decktape/issues/130/events","html_url":"https://github.com/astefanutti/decktape/issues/130","id":293852633,"node_id":"MDU6SXNzdWUyOTM4NTI2MzM=","number":130,"title":"How to pass arg to Puppeteer via decktape command line?","user":{"login":"gitpitch","id":19169584,"node_id":"MDQ6VXNlcjE5MTY5NTg0","avatar_url":"https://avatars3.githubusercontent.com/u/19169584?v=4","gravatar_id":"","url":"https://api.github.com/users/gitpitch","html_url":"https://github.com/gitpitch","followers_url":"https://api.github.com/users/gitpitch/followers","following_url":"https://api.github.com/users/gitpitch/following{/other_user}","gists_url":"https://api.github.com/users/gitpitch/gists{/gist_id}","starred_url":"https://api.github.com/users/gitpitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitpitch/subscriptions","organizations_url":"https://api.github.com/users/gitpitch/orgs","repos_url":"https://api.github.com/users/gitpitch/repos","events_url":"https://api.github.com/users/gitpitch/events{/privacy}","received_events_url":"https://api.github.com/users/gitpitch/received_events","type":"User","site_admin":false},"labels":[{"id":208780690,"node_id":"MDU6TGFiZWwyMDg3ODA2OTA=","url":"https://api.github.com/repos/astefanutti/decktape/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-02-02T11:08:21Z","updated_at":"2018-10-19T10:50:14Z","closed_at":"2018-10-19T10:50:14Z","author_association":"NONE","body":"Not sure if this is a bug or I'm simply doing it incorrectly but I am trying to pass the `--allow-file-access-from-files` arg on the decktape command line. My hope is to see the arg passed on to Puppeteer.launch() which would then configure the underlying Chrome instance for the behavior that I need.\r\n\r\nI tried the following on the command line:\r\n\r\n```\r\n/bin/decktape reveal /home/index.html ./out.pdf --allow-file-access-from-files\r\n```\r\n\r\nThat resulted in the following error message in the console output:\r\n\r\n```\r\n'--allow-file-access-from-files' expects a value\r\n```\r\n\r\nYou can see it fails with the `expects a value` error message. I tracked that message down to `lib/nonnom.js` which is parsing/processing the args list.\r\n\r\nI also tried to place the arg at the start as follows:\r\n\r\n```\r\n$ /bin/decktape --allow-file-access-from-files reveal /home/index.html ./out.pdf\r\n\r\ncommand 'reveal' is expected to be the first argument\r\n```\r\nAs you can see, this too results in an error.\r\n\r\nGiven I could not get this to work I decided to make the following tweak to `decktape.js` to see if I could bypass args passing/processing and just manually configure Puppeteer for the args that I want:\r\n\r\n```\r\n(async () => {\r\n\r\n  const browser = await puppeteer.launch({\r\n    headless : true,\r\n    executablePath: options.executablePath,\r\n    /*\r\n    args     : Object.keys(options).reduce((args, option) => {\r\n      switch (option) {\r\n        case 'sandbox':\r\n          if (options.sandbox === false) args.push('--no-sandbox');\r\n          break;\r\n      }\r\n      return args;\r\n    }, [])\r\n    */\r\n    args: [ '--allow-file-access-from-files' ],\r\n  });\r\n  const page = await browser.newPage();\r\n  await page.emulateMedia('screen');\r\n  const printer = hummus.createWriter(options.filename);\r\n  const metadata = printer.getDocumentContext().getInfoDictionary();\r\n  metadata.creator = 'Decktape';\r\n```\r\n\r\nYou can see above that I commented out the original args parsing code block and replaced it with a static args array that contains the command line arg I want to pass to Puppeteer:\r\n\r\n```\r\n    args: [ '--allow-file-access-from-files' ]\r\n```\r\n\r\nThis change to `decktape.js` gave me exactly the behavior that I want from Puppeteer/Chrome when I executed the following on the command line:\r\n\r\n```\r\n/bin/decktape reveal /home/index.html ./out.pdf\r\n```\r\n\r\nSo my question is this, what is the correct syntax using the official `decktape.js` in order to execute \r\nmy command that would ensure the `--allow-file-access-from-files` arg would be passed through to Puppeteer?\r\n\r\nThanks for any help you can provide."},"comment":{"url":"https://api.github.com/repos/astefanutti/decktape/issues/comments/431323853","html_url":"https://github.com/astefanutti/decktape/issues/130#issuecomment-431323853","issue_url":"https://api.github.com/repos/astefanutti/decktape/issues/130","id":431323853,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTMyMzg1Mw==","user":{"login":"astefanutti","id":366207,"node_id":"MDQ6VXNlcjM2NjIwNw==","avatar_url":"https://avatars0.githubusercontent.com/u/366207?v=4","gravatar_id":"","url":"https://api.github.com/users/astefanutti","html_url":"https://github.com/astefanutti","followers_url":"https://api.github.com/users/astefanutti/followers","following_url":"https://api.github.com/users/astefanutti/following{/other_user}","gists_url":"https://api.github.com/users/astefanutti/gists{/gist_id}","starred_url":"https://api.github.com/users/astefanutti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astefanutti/subscriptions","organizations_url":"https://api.github.com/users/astefanutti/orgs","repos_url":"https://api.github.com/users/astefanutti/repos","events_url":"https://api.github.com/users/astefanutti/events{/privacy}","received_events_url":"https://api.github.com/users/astefanutti/received_events","type":"User","site_admin":false},"created_at":"2018-10-19T10:50:14Z","updated_at":"2018-10-19T10:50:14Z","author_association":"OWNER","body":"Fixed with 6b46a957801ddc518133df24a9c73acf6bc968f5."}}
{"actor":{"display_login":"astefanutti"}}