Skip to content

Add pre-commit hooks #39

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
12 changes: 6 additions & 6 deletions Class usage primer.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Below is the code sample how that could be achieved using `Json.hpp` class and t
using namespace std;


int main(int argc, char *argv[]) {
int main(int argc, char *argv[]) {
// read and parse json from cin:
Json jin{ {istream_iterator<char>{cin>>noskipws}, istream_iterator<char>{}} };

// get all the names into vector and sort them
vector<string> names{jin.walk("<Name>l:"), jin.walk().end()};
sort(names.begin(), names.end());
Expand All @@ -29,16 +29,16 @@ int main(int argc, char *argv[]) {
for(const auto &name: names)
sorted.push_back(move( *jin.walk("[Name]:<" + name + ">[-1]") ));

// // put back into the original container and print using indentation 3
jin["AddressBook"].clear().push_back( move(sorted) );
// // put back into the original container and print using indentation 3
jin["AddressBook"].clear().push_back( move(sorted) );
cout << jin.tab(3) << endl;
}
```

**Output result:**
```bash
bash $ c++ -o sort_ab -Wall -std=c++14 sorting_ab.cpp
bash $
bash $
bash $ <addressbook-sample.json sort_ab | jtc -tc # using jtc here only for a compact view
{
"AddressBook": [
Expand Down Expand Up @@ -79,7 +79,7 @@ bash $ <addressbook-sample.json sort_ab | jtc -tc # using jtc here only for
]
]
}
bash $
bash $
```
for the complete description of Json class interface, refer to [Json.hpp](https://github.com/ldn-softdev/jtc/blob/master/lib/Json.hpp)

Expand Down
102 changes: 48 additions & 54 deletions README.md

Large diffs are not rendered by default.

936 changes: 464 additions & 472 deletions User Guide.md

Large diffs are not rendered by default.

Loading