Skip to content

Commit

Permalink
chore(doc): auto generate docs
Browse files Browse the repository at this point in the history
docs: fix format on readme

chore(doc): auto generate docs
  • Loading branch information
github-actions[bot] authored and Dung Huynh Duc committed Jul 19, 2024
1 parent 61ec2e7 commit c53820c
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 83 deletions.
110 changes: 47 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,8 @@ To change the environment file name, use the `HurlSetEnvFile` command followed b

This is a feature that allows you to define custom variables in your `.hurl` files. You can define a list of custom variables with a name and a callback function that returns the value of the variable. The callback function is executed every time the variable is used in the `.hurl` file.

> Note
> [!NOTE]
> This is a workaround to inject dynamic variables into the hurl command, refer https://github.com/Orange-OpenSource/hurl/issues?q=sort:updated-desc+is:open+label:%22topic:+generators%22
> -- This is a workaround to inject dynamic variables into the hurl command, refer https://github.com/Orange-OpenSource/hurl/issues?q=sort:updated-desc+is:open+label:%22topic:+generators%22
```lua
-- Custom below to add your own fixture variables
Expand Down Expand Up @@ -269,70 +268,55 @@ These key mappings are active within the popup windows that `hurl.nvim` displays

`hurl.nvim` can be customized with the following default configurations:

<details><summary>Default Options</summary>

</details>
```lua
--- Default configuration for hurl.nvim
local default_config = {
-- Toggle debugging information
debug = false, -- If true, logs will be saved at ~/.local/state/nvim/hurl.nvim.log

-- Set the display mode for the response: 'split' or 'popup'
mode = 'split',

-- Split settings
split_position = "right",
split_size = "50%",

-- Popup settings
popup_position = '50%',
popup_size = {
width = 80,
height = 40,
},

-- Default environment file name
env_file = {
'vars.env',
},

-- Default test fixtures
fixture_vars = {
{
name = 'random_int_number',
callback = function()
return math.random(1, 1000)
end,
},
{
name = 'random_float_number',
callback = function()
local result = math.random() \* 10
return string.format('%.2f', result)
end,
},
},

-- Specify formatters for different response types
formatters = {
json = { 'jq' }, -- Uses jq to format JSON responses
html = {
'prettier', -- Uses prettier to format HTML responses
'--parser',
'html',
},
xml = {
'tidy', -- Uses tidy to format XML responses
'-xml',
'-i',
'-q',
},
},
debug = false,
mode = 'split',
show_notification = false,
auto_close = true,
-- Default split options
split_position = 'right',
split_size = '50%',
-- Default popup options
popup_position = '50%',
popup_size = {
width = 80,
height = 40,
},
env_file = { 'vars.env' },
fixture_vars = {
{
name = 'random_int_number',
callback = function()
return math.random(1, 1000)
end,
},
{
name = 'random_float_number',
callback = function()
local result = math.random() * 10
return string.format('%.2f', result)
end,
},
},
find_env_files_in_folders = utils.find_env_files_in_folders,
formatters = {
json = { 'jq' },
html = {
'prettier',
'--parser',
'html',
},
xml = {
'tidy',
'-xml',
'-i',
'-q',
},
},
}

````

</details>
```

To apply these configurations, include them in your Neovim setup like this:

Expand Down
97 changes: 77 additions & 20 deletions doc/hurl.nvim.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*hurl.nvim.txt* For NVIM v0.8.0 Last change: 2024 July 15
*hurl.nvim.txt* For NVIM v0.8.0 Last change: 2024 July 19

==============================================================================
Table of Contents *hurl.nvim-table-of-contents*
Expand All @@ -7,6 +7,7 @@ Table of Contents *hurl.nvim-table-of-contents*
- Features |hurl.nvim-features|
- Usage |hurl.nvim-usage|
- Env File Support: vars.env |hurl.nvim-env-file-support:-vars.env|
- Test fixtures |hurl.nvim-test-fixtures|
- Demo |hurl.nvim-demo|
- HurlSetVariable |hurl.nvim-hurlsetvariable|
- HurlManageVariable |hurl.nvim-hurlmanagevariable|
Expand Down Expand Up @@ -34,6 +35,10 @@ FEATURES *hurl.nvim-features*
- 🚀 Execute HTTP requests directly from `.hurl` files.
- 👁‍🗨 Multiple display modes for API response: popup or split.
- 🌈 Highly customizable through settings.
- 📦 Environment file support for managing environment variables.
- 🛠 Set environment variables with `HurlSetVariable` command.
- 📝 View and manage environment variables with `HurlManageVariable` command.
- 📜 View the response of your last HTTP request with `HurlShowLastResponse` command.


USAGE *hurl.nvim-usage*
Expand Down Expand Up @@ -175,6 +180,50 @@ NOTES
- This change will apply globally for the current session of Neovim. If you restart Neovim, it will revert to the default `vars.env` unless you change it again.


TEST FIXTURES *hurl.nvim-test-fixtures*

This is a feature that allows you to define custom variables in your `.hurl`
files. You can define a list of custom variables with a name and a callback
function that returns the value of the variable. The callback function is
executed every time the variable is used in the `.hurl` file.


[!NOTE] This is a workaround to inject dynamic variables into the hurl command,
refer
https://github.com/Orange-OpenSource/hurl/issues?q=sort:updated-desc+is:open+label:%22topic:+generators%22
>lua
-- Custom below to add your own fixture variables
fixture_vars = {
{
name = 'random_int_number',
callback = function()
return math.random(1, 1000)
end,
},
{
name = 'random_float_number',
callback = function()
local result = math.random() * 10
return string.format('%.2f', result)
end,
},
}
<

Then you can use `{{random_int_number}}` and `{{random_float_number}}` in your
`.hurl` files.

>hurl
POST https://api.example.com
Content-Type: application/json

{
"name": "Product ID {{random_int_number}}",
"price": {{random_float_number}}
}
<


DEMO *hurl.nvim-demo*

Check out the following demos to see `hurl.nvim` in action:
Expand Down Expand Up @@ -301,39 +350,47 @@ CONFIGURATION *hurl.nvim-configuration*
`hurl.nvim` can be customized with the following default configurations:

>lua
--- Default configuration for hurl.nvim
local default_config = {
-- Toggle debugging information
debug = false, -- If true, logs will be saved at ~/.local/state/nvim/hurl.nvim.log

-- Set the display mode for the response: 'split' or 'popup'
debug = false,
mode = 'split',

-- Split settings
split_position = "right",
split_size = "50%",

-- Popup settings
show_notification = false,
auto_close = true,
-- Default split options
split_position = 'right',
split_size = '50%',
-- Default popup options
popup_position = '50%',
popup_size = {
width = 80,
height = 40,
},

-- Default environment file name
env_file = {
'vars.env',
env_file = { 'vars.env' },
fixture_vars = {
{
name = 'random_int_number',
callback = function()
return math.random(1, 1000)
end,
},
{
name = 'random_float_number',
callback = function()
local result = math.random() * 10
return string.format('%.2f', result)
end,
},
},

-- Specify formatters for different response types
find_env_files_in_folders = utils.find_env_files_in_folders,
formatters = {
json = { 'jq' }, -- Uses jq to format JSON responses
json = { 'jq' },
html = {
'prettier', -- Uses prettier to format HTML responses
'prettier',
'--parser',
'html',
},
xml = {
'tidy', -- Uses tidy to format XML responses
'tidy',
'-xml',
'-i',
'-q',
Expand Down

0 comments on commit c53820c

Please sign in to comment.