Skip to content

fixed not working cmd command for uploading and executing local scripts #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 16, 2017

Conversation

wehrstedt
Copy link
Contributor

Fixed the not working cmd command tool.
Added recursive file searching.
Improved the wildcard resolving of file paths.

@wehrstedt
Copy link
Contributor Author

@bkircher please have a look

@wehrstedt
Copy link
Contributor Author

there were two semicolons...

Copy link
Contributor

@bkircher bkircher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! What do I have to do in order to test these changes?

src/cmd.ts Outdated
// console.log('test ' + dir_i);
// });
.action(function (json: string, dir: string[]) {
console.log("Note:\nIf you you use wildcards in the path to the dir to upload, set the path in quoatmarks.\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: quotemarks

src/cmd.ts Outdated
@@ -13,27 +14,43 @@ var program = require('commander');
// set up sdsAccess


async function uploadAndRunAll(loginData: config.LoginData, folder: string, prefix: string): Promise<sdsAccess.scriptT[]> {
async function uploadAndRunAll(loginData: config.LoginData, files: sdsAccess.scriptT[]): Promise<sdsAccess.scriptT[]> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You change the API here. What implications has this for consumers of this library?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that the whole script actually was implemented for me to execute and upload scripts from the command line. Also, this function is not exported, so the only place where this function can be used is in the same script. But you're right, it would be better to split this into multiple functions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Since you're the only one using it and it is not exported the change is fine. 👍

src/cmd.ts Outdated
function readDirSync(dir: string, rec: boolean = true): string[] {
var results: string[] = [];
var list = fs.readdirSync(dir);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use let instead of var. Even better const.

src/cmd.ts Outdated
// uploadAndRunAll(loginData, dirToUpload, execPrefix);
// } else {
// console.log('Dir/file to run/upload missing');
// }
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not commit commented-out lines. Just remove them. Use git for version control.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, forgot to remove these lines 🙈

@wehrstedt
Copy link
Contributor Author

You have to execute the following command: node src/out/cmd.js test <path-to-launch.json>

I will add this to the documentation tomorrow.

@bkircher
Copy link
Contributor

I will add this to the documentation tomorrow.

Great!

Can you also push one or more commits with the requested changes to this PR ? Then I will test and merge.

@wehrstedt
Copy link
Contributor Author

sorry, i made a lot of changes and splitted the changes into multiple functions. Now there are two more cmd-commands for upload and execute scripts from the command line. I didn't changed the old cmd command, just fixed the issue there so that this command is now ready to use.

@wehrstedt
Copy link
Contributor Author

can you tag the changes if this PR is fine?

@tineheller tineheller self-assigned this Aug 15, 2017
@tineheller tineheller self-requested a review August 15, 2017 08:17
@tineheller tineheller merged commit ec76d08 into otris:master Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants