mirror of
https://github.com/nushell/nushell
synced 2024-11-10 23:24:14 +00:00
Add documentation for the open command
This commit is contained in:
parent
b066775630
commit
81fec11f88
1 changed files with 95 additions and 0 deletions
95
docs/commands/open.md
Normal file
95
docs/commands/open.md
Normal file
|
@ -0,0 +1,95 @@
|
|||
# open
|
||||
|
||||
Loads a file into a cell, convert it to table if possible (avoid by appending `--raw` flag)
|
||||
|
||||
## Example
|
||||
|
||||
```shell
|
||||
> cat user.yaml
|
||||
- Name: Peter
|
||||
Age: 30
|
||||
Telephone: 88204828
|
||||
Country: Singapore
|
||||
- Name: Michael
|
||||
Age: 42
|
||||
Telephone: 44002010
|
||||
Country: Spain
|
||||
- Name: Will
|
||||
Age: 50
|
||||
Telephone: 99521080
|
||||
Country: Germany
|
||||
> open user.yaml
|
||||
━━━┯━━━━━━━━━┯━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━
|
||||
# │ Name │ Age │ Telephone │ Country
|
||||
───┼─────────┼─────┼───────────┼───────────
|
||||
0 │ Peter │ 30 │ 88204828 │ Singapore
|
||||
1 │ Michael │ 42 │ 44002010 │ Spain
|
||||
2 │ Will │ 50 │ 99521080 │ Germany
|
||||
━━━┷━━━━━━━━━┷━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━
|
||||
> open user.yaml --raw
|
||||
- Name: Peter
|
||||
Age: 30
|
||||
Telephone: 88204828
|
||||
Country: Singapore
|
||||
- Name: Michael
|
||||
Age: 42
|
||||
Telephone: 44002010
|
||||
Country: Spain
|
||||
- Name: Will
|
||||
Age: 50
|
||||
Telephone: 99521080
|
||||
Country: Germany
|
||||
```
|
||||
|
||||
```shell
|
||||
> cat user.json
|
||||
[
|
||||
{
|
||||
"Name": "Peter",
|
||||
"Age": 30,
|
||||
"Telephone": 88204828,
|
||||
"Country": "Singapore"
|
||||
},
|
||||
{
|
||||
"Name": "Michael",
|
||||
"Age": 42,
|
||||
"Telephone": 44002010,
|
||||
"Country": "Spain"
|
||||
},
|
||||
{
|
||||
"Name": "Will",
|
||||
"Age": 50,
|
||||
"Telephone": 99521080,
|
||||
"Country": "Germany"
|
||||
}
|
||||
]
|
||||
> open user.json
|
||||
━━━┯━━━━━━━━━┯━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━━
|
||||
# │ Name │ Age │ Telephone │ Country
|
||||
───┼─────────┼─────┼───────────┼───────────
|
||||
0 │ Peter │ 30 │ 88204828 │ Singapore
|
||||
1 │ Michael │ 42 │ 44002010 │ Spain
|
||||
2 │ Will │ 50 │ 99521080 │ Germany
|
||||
━━━┷━━━━━━━━━┷━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━━
|
||||
> open user.json --raw
|
||||
[
|
||||
{
|
||||
"Name": "Peter",
|
||||
"Age": 30,
|
||||
"Telephone": 88204828,
|
||||
"Country": "Singapore"
|
||||
},
|
||||
{
|
||||
"Name": "Michael",
|
||||
"Age": 42,
|
||||
"Telephone": 44002010,
|
||||
"Country": "Spain"
|
||||
},
|
||||
{
|
||||
"Name": "Will",
|
||||
"Age": 50,
|
||||
"Telephone": 99521080,
|
||||
"Country": "Germany"
|
||||
}
|
||||
]
|
||||
```
|
Loading…
Reference in a new issue