-
Notifications
You must be signed in to change notification settings - Fork 103
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
Add --json-file/-j option to read from file w/ json contents #311
Closed
Closed
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
0fbb22d
wip: simple json handling - needs big clean up
jacobmealey 9e2f4a4
clean up source code
jacobmealey 0bd91b6
added more tests, need to add special handling for queries
jacobmealey 0e22840
finalized testing and found a bug where querys all stack together
jacobmealey e01fd50
query strings generating. need to fix for iteration
jacobmealey 3d55d30
cleaning up for pr
jacobmealey dcea792
test w/ actions
jacobmealey 41bb29e
Added sudo back
jacobmealey 18ecad7
put json objects
jacobmealey 29de2be
remove putting whole object?
jacobmealey a1d0ed8
removed whole line
jacobmealey ba76262
fixed memory issues
jacobmealey 5618105
remove sanitizer
jacobmealey 1d9d70d
spelling
jacobmealey 1685194
attempting to make everything play nice
jacobmealey 0785c94
fixed typo
jacobmealey 5264619
different packages and paths
jacobmealey 20c3b8c
cleaned up tests
jacobmealey 73b272a
removed mac os specifics from makefile, clean style
jacobmealey 95fa596
remove params putting
jacobmealey 26e4859
not leaking
jacobmealey bb1a0e3
free this_query
jacobmealey 373bec0
clean up for pr
jacobmealey 1851fee
cleanup file handling
jacobmealey cc74cdf
get other actions working -- need to get curl for win working
jacobmealey b44e296
undo file cleanup... doesn't work on windows
jacobmealey 542fe6a
put json in behind a flag
jacobmealey 6ceea4a
fix whitespace in tests.json
jacobmealey 12e6725
white space Update .github/workflows/makefile.yml
jacobmealey 6eb908e
Update homebrew includes .github/workflows/makefile.yml
jacobmealey 292fd77
Update .github/workflows/makefile.yml
jacobmealey a8dad0a
make --json-file act like other optional builds
jacobmealey ad93491
Merge branch 'trurl-json-in' of github.com:jacobmealey/urler into tru…
jacobmealey aa39f61
Make it act as a filter
jacobmealey e5e2429
added error check for parts key
jacobmealey ede3153
style
jacobmealey aa7d58b
update oom messaging
jacobmealey d2b3fca
cleanup makefile
jacobmealey 2f81538
Update Makefile
jacobmealey 3975591
flip around the lines
jacobmealey 1c22c47
makefile JSON_C_PREFIX, update readme
jacobmealey e6f135e
cleanup readme
jacobmealey a947832
trying setting json_c_path in GITHUB_ENV
jacobmealey 7502449
prefix not path
jacobmealey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
[ | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}}, | ||
{ | ||
"parts": { | ||
"host": "example.com" | ||
}} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[ | ||
{ | ||
"parts": { | ||
"scheme": "ftp", | ||
"user": "scream", | ||
"host": "url.com", | ||
"path": "/", | ||
"query": "ignoredquery", | ||
"fragment": "a-fragment" | ||
}, | ||
"params": [ | ||
{ | ||
"key": "query", | ||
"value": "pair" | ||
}, | ||
{ | ||
"key": "singlequery", | ||
} | ||
] | ||
}, | ||
{ | ||
"parts": { | ||
"scheme": "http", | ||
"host": "example.org", | ||
"path": "/" | ||
} | ||
}, | ||
{ | ||
"url": "example.com" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2499,6 +2499,20 @@ | |
"returncode": 0 | ||
} | ||
}, | ||
{ | ||
"required": ["json-input"], | ||
"input": { | ||
"arguments": [ | ||
"--json-file", | ||
"testfiles/test0003.txt" | ||
] | ||
}, | ||
"expected": { | ||
"returncode": 0, | ||
"stderr": "", | ||
"stdout": "http://example.com/\nhttp://example.com/\nhttp://example.com/\nhttp://example.com/\nhttp://example.com/\nhttp://example.com/\nhttp://example.com/\nhttp://example.com/\nhttp://example.com/\nhttp://example.com/\nhttp://example.com/\nhttp://example.com/\nhttp://example.com/\nhttp://example.com/\nhttp://example.com/\nhttp://example.com/\n" | ||
} | ||
}, | ||
{ | ||
"input": { | ||
"arguments": [ | ||
|
@@ -2544,5 +2558,49 @@ | |
"stderr": "", | ||
"returncode": 0 | ||
} | ||
}, | ||
{ | ||
"required": ["json-input"], | ||
"input": { | ||
"arguments": [ | ||
"-j", | ||
"testfiles/test0001.txt" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
] | ||
}, | ||
"expected": { | ||
"returncode": 13 , | ||
"stderr": "trurl error: Cannot parse JSON, expected an array of objects.\ntrurl error: Try trurl -h for help\n", | ||
"stdout": "" | ||
} | ||
}, | ||
{ | ||
"required": ["json-input"], | ||
"input": { | ||
"arguments": [ | ||
"-j", | ||
"testfiles/test0004.txt" | ||
] | ||
}, | ||
"expected": { | ||
"returncode": 0, | ||
"stderr": "trurl note: ignoring 'query', provide a separate 'params' array.\ntrurl note: Required key \"parts\" not found in json object.\n", | ||
"stdout": "ftp://[email protected]/?query=pair&singlequery#a-fragment\nhttp://example.org/\n" | ||
} | ||
}, | ||
{ | ||
"required": ["json-input"], | ||
"input": { | ||
"arguments": [ | ||
"-j", | ||
"testfiles/test0004.txt", | ||
"--set", | ||
"user=person" | ||
] | ||
}, | ||
"expected": { | ||
"returncode": 0, | ||
"stderr": "trurl note: ignoring 'query', provide a separate 'params' array.\ntrurl note: Required key \"parts\" not found in json object.\n", | ||
"stdout": "ftp://[email protected]/?query=pair&singlequery#a-fragment\nhttp://[email protected]/\n" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find any info on
-Wno-gnu
is it necessary? because it breaks the build on older GCCs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm thats not good. It was required by json-c , I think some of there macros are what required this. I'm wondering if we should jump out of json-c, and use one that is purely c89 (and small enough we can just include the source in the repo or something like @vszakats has been saying)
I think a lot of the scaffolding can stay in place for parsing single objects / streaming stuff. it would really just be the guts of from_json() that would need to be swapped out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What OS / compiler have you been using?