{"action":"closed","issue":{"url":"https://api.github.com/repos/dpnishant/appmon/issues/36","repository_url":"https://api.github.com/repos/dpnishant/appmon","labels_url":"https://api.github.com/repos/dpnishant/appmon/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/dpnishant/appmon/issues/36/comments","events_url":"https://api.github.com/repos/dpnishant/appmon/issues/36/events","html_url":"https://github.com/dpnishant/appmon/issues/36","id":237241350,"number":36,"title":"How to avoid code-reuse in scripts?","user":{"login":"markszabo","id":12611720,"avatar_url":"https://avatars1.githubusercontent.com/u/12611720?v=4","gravatar_id":"","url":"https://api.github.com/users/markszabo","html_url":"https://github.com/markszabo","followers_url":"https://api.github.com/users/markszabo/followers","following_url":"https://api.github.com/users/markszabo/following{/other_user}","gists_url":"https://api.github.com/users/markszabo/gists{/gist_id}","starred_url":"https://api.github.com/users/markszabo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markszabo/subscriptions","organizations_url":"https://api.github.com/users/markszabo/orgs","repos_url":"https://api.github.com/users/markszabo/repos","events_url":"https://api.github.com/users/markszabo/events{/privacy}","received_events_url":"https://api.github.com/users/markszabo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-06-20T14:58:07Z","updated_at":"2017-11-16T18:27:49Z","closed_at":"2017-11-16T18:27:49Z","author_association":"CONTRIBUTOR","body":"I'm about to develop several, very similar scripts for iOS and I would like to avoid code-reuse. Is there a way of putting commonly used functions into a separate js file (eg tools.js) and include this file in each script? I want to be able to run all scripts with `-s folder` but also any individual script with `-s folder/script12.js`.\r\n\r\nCurrently I check if the needed functions are defined and if not display a warning asking the user to also include tools.js (please run the script with the additional `-s tools.js` parameter), but it would be better to make it automatically.\r\n\r\nIf there is no solution right now, what came to my mind is to have an import statement in the beginning of the js files as a comment, e.g.: `//import tools.js` and then in `appmon.py - merge_scripts()` check for this line and also include the imported files to `merged.js`. If you think this is a good feature, I would be happy to implement it and send a PR.\r\n\r\nBest regards,\r\nMark"}}
{"actor":{"display_login":"dpnishant"}}