Skip to content

Commit

Permalink
docs(readme): Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ajtejankar committed Jan 30, 2016
1 parent 5a7c1e2 commit 1bac982
Show file tree
Hide file tree
Showing 2 changed files with 211 additions and 0 deletions.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# JSH

Utility for processing json on command line.

# Installation

You need node and npm to use this program.

```
npm i -g chigur/jsh
```

# Why?

There are already some projects that solve the problem of command line json
processing but I just didn't like learning any of them, so I made my own
command line utility for it. This program doesn't invent fancy json querying
and manipulating syntax. Querying is done by globs and manipulating is done
by javascript. Simple and easy.

# How?

```
curl https://api.github.com/users/chigur/gists | jsh ' **/description { pf($val) } '
```

Jsh takes pairs of `pattern` and `action` in following format.

```
<pattern> { <action> // pair 1 }
<pattern> { <action> // pair 2 }
```

Patterns are glob patterns, your json is flattened into key value pairs where
keys resemeble file paths.

Consider following object

```json
{
"name": {
"arr": [1],
"age": 21
}
}
```

It becomes

```
/name/arr/0 1
/name/age 21
```

Actions are any valid javascript code snippets, they can use certain aliases
and variables like `$key` for the path or key, `$val` for value, `pf` and `bn`
functions as aliases for `console.log` and `require('path').basename` respectively.
Actions can contain javascript style comments and span across multiple lines.
153 changes: 153 additions & 0 deletions metadat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{
"elements": [{
"name": "t-autosuggest",
"category": "form",
"icon": "Autosuggest",
"displayName": "Auto Suggest",
"location": "https://github.com/atomelements/t-autosuggest"
}, {
"name": "t-button",
"category": "form",
"icon": "Button",
"displayName": "Button",
"location": "https://github.com/atomelements/t-button"
}, {
"name": "t-calendar",
"category": "form",
"icon": "Calendar",
"displayName": "Calendar",
"location": "https://github.com/atomelements/t-calendar"
}, {
"name": "t-checkbox-group",
"category": "form",
"icon": "Checkbox",
"displayName": "Checkbox List",
"location": "https://github.com/atomelements/t-checkbox-group"
}, {
"name": "t-colorpicker",
"category": "form",
"icon": "Color_Palette",
"displayName": "Color Picker",
"location": "https://github.com/atomelements/t-colorpicker"
}, {
"name": "t-dropdown",
"category": "form",
"icon": "Dropdown",
"displayName": "Dropdown",
"location": "https://github.com/atomelements/t-dropdown"
}, {
"name": "t-error-block",
"category": "page",
"displayName": "Error Block",
"location": "https://github.com/atomelements/t-error-block"
}, {
"name": "t-google-map",
"category": "page",
"icon": "Map",
"displayName": "Google Map",
"location": "https://github.com/atomelements/t-google-map"
}, {
"name": "t-icon-selector",
"category": "form",
"displayName": "Icon Selector",
"location": "https://github.com/atomelements/t-icon-selector"
}, {
"name": "t-image",
"category": "page",
"icon": "Image",
"displayName": "Image",
"location": "https://github.com/atomelements/t-image"
}, {
"name": "t-input",
"category": "form",
"icon": "Input_Field",
"displayName": "Input Field",
"location": "https://github.com/atomelements/t-input"
}, {
"name": "t-list",
"category": "page",
"displayName": "list",
"location": "https://github.com/atomelements/t-list"
}, {
"name": "t-loader",
"category": "page",
"icon": "Loader",
"displayName": "Loader",
"location": "https://github.com/atomelements/t-loader"
}, {
"name": "t-notify",
"category": "page",
"displayName": "Notification",
"location": "https://github.com/atomelements/t-notify"
}, {
"name": "t-progress",
"category": "page",
"icon": "Progress_bar",
"displayName": "Progress Bar",
"location": "https://github.com/atomelements/t-progress"
}, {
"name": "t-radio-group",
"category": "form",
"icon": "Radio_List",
"displayName": "Radio List",
"location": "https://github.com/atomelements/t-radio-group"
}, {
"name": "t-range",
"category": "form",
"displayName": "Range",
"location": "https://github.com/atomelements/t-range"
}, {
"name": "t-section-header",
"category": "form",
"icon": "Section_Header",
"displayName": "Section Header",
"location": "https://github.com/atomelements/t-section-header"
}, {
"name": "t-slider",
"category": "form",
"icon": "Slider",
"displayName": "Slider",
"location": "https://github.com/atomelements/t-slider"
}, {
"name": "t-stepper",
"category": "form",
"icon": "Calendar",
"displayName": "Stepper",
"location": "https://github.com/atomelements/t-stepper"
}, {
"name": "t-table",
"category": "data",
"icon": "Table",
"displayName": "Table",
"location": "https://github.com/atomelements/t-table"
}, {
"name": "t-tabs",
"category": "page",
"icon": "Map",
"displayName": "Tabs",
"location": "https://github.com/atomelements/t-tabs"
}, {
"name": "t-google-youtube",
"category": "page",
"icon": "Video",
"displayName": "Youtube Video",
"location": "https://github.com/atomelements/t-google-youtube"
}, {
"name": "demo-tester",
"displayName": "Demo Tester",
"location": "components/demo-tester"
}],
"categories": [{
"name": "data",
"displayName": "Data"
}, {
"name": "form",
"displayName": "Form Basic"
}, {
"name": "form-composite",
"displayName": "Form Composite"
}, {
"name": "page",
"displayName": "Page"
}]
}

0 comments on commit 1bac982

Please sign in to comment.