Skip to content
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

Revamp comment.sh shell script #138

Closed
jethrosun opened this issue Aug 27, 2017 · 8 comments
Closed

Revamp comment.sh shell script #138

jethrosun opened this issue Aug 27, 2017 · 8 comments

Comments

@jethrosun
Copy link

Ever since leetcode org changed their website, the regx in the comment.sh is kinda broken. Any idea to fix it?

@haoel
Copy link
Owner

haoel commented Feb 1, 2018

They use the GraphQL API, I will update my script soon.

very soon......

haoel added a commit that referenced this issue Feb 1, 2018
@haoel
Copy link
Owner

haoel commented Feb 1, 2018

@shwsun please test the new scripts

@jethrosun
Copy link
Author

Hi, I think there are only two slight problems:

  1. in the query_problem.sh we should use -s instead of -q since that is already deprecated.
  2. the question description is not really inserted into the source_file, I think the ${TMP_FILE} should be ${source_file}.

@haoel
Copy link
Owner

haoel commented Feb 2, 2018

for 1), you mean the option for xidel command should use -s rather than -q ? (the xidel acutally hasn't -s option)

for 2), the ${TMP_FILE} is a temporary file which will be insert into $source_file late.

#insert the problem description into the source file, and remove it
sed -i.bak '4 r '${TMP_FILE}'' ${source_file}

may I know more details?

@haoel
Copy link
Owner

haoel commented Feb 4, 2018

@shwsun any feedback?

@jethrosun
Copy link
Author

@haoel I am pretty sure about the param problem. Is it because of the newer version of xidel?

[~/repos/leetcode/scripts]-[master↓]── - xidel -q
-quiet,-q is outdated. Use --silent,-s

Re the other issue, the comment.sh still can't get the problem description into the file from my side.

[~/repos/leetcode/scripts]-[master↓]── - ./comments.sh https://leetcode.com/problems/largest-number/

-quiet,-q is outdated. Use --silent,-s
-quiet,-q is outdated. Use --silent,-s
-quiet,-q is outdated. Use --silent,-s
-quiet,-q is outdated. Use --silent,-s
-quiet,-q is outdated. Use --silent,-s
./comments.sh: line 85: [: ==: unary operator expected
Create a new file - LargestNumber.cpp.
LargestNumber.cpp updated !
[~/repos/leetcode/scripts]-[master↓]── - cat LargestNumber.cpp 
// Source : https://leetcode.com/problems/largest-number/
// Author : shwsun
// Date   : 2018-02-05

/*************************************************************************************** 
 *
 * 
 ***************************************************************************************/

I am running Ubuntu, could you get a Linux and test it a bit?

@haoel
Copy link
Owner

haoel commented Feb 5, 2018

Thanks for more information.

Yes, the script I only tested on MacOS. And on linux platform, xidel rename the -q option to -s after version 0.9.4, so I need to check the options.

Now, I fix it in commit 0fdf100

@haoel haoel changed the title Revamp comment.sh shell scrip Revamp comment.sh shell script Feb 5, 2018
@haoel
Copy link
Owner

haoel commented Feb 7, 2018

I am going to close this issue, @shwsun you can reopen it if anything's still problem

@haoel haoel closed this as completed Feb 7, 2018
haoel added a commit that referenced this issue Nov 5, 2020
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

No branches or pull requests

2 participants