Skip to content

The :HurlManageVariable command doesn't persist values (and doesn't prepopulate from env_file) #219

@componhead

Description

@componhead

Details

No response


Enhance :HurlManageVariable with persistence and env file integration

Description:

The :HurlManageVariable command currently lacks persistence between sessions and doesn't load initial values from the configured env files. This needs to be fixed to improve variable management functionality.

Tasks:

  1. In lua/hurl/main.lua:

    • Modify HurlManageVariable command to load variables from env files on initialization
    • Add persistence functionality to save variables between sessions
    • Update variable management popup to reflect both env file and persisted variables
  2. In lua/hurl/lib/hurl_runner.lua:

    • Add function to parse env files and extract variables
    • Modify variable injection logic to handle both persisted and env file variables
  3. In test/plugin_spec.lua:

    • Add test cases for variable persistence
    • Add test cases for env file variable loading
    • Add test cases for variable management popup

Test:

  • Add the following test cases to test/plugin_spec.lua:
    it('should load variables from env file', function()
      -- Test env file loading
    end)
    
    it('should persist variables between sessions', function()
      -- Test variable persistence
    end)
    
    it('should show both env file and persisted variables in popup', function()
      -- Test popup display
    end)

Add persistence and env file integration to HurlManageVariable

Description:

Enhance the :HurlManageVariable command to persist variables between sessions and load initial values from configured env files.

Tasks:

  1. In lua/hurl/main.lua:

    • Add function to load variables from env files into _HURL_GLOBAL_CONFIG.global_vars
    • Modify HurlManageVariable command to:
      • Read from vim.fn.stdpath('data')/hurl-nvim/variables.json
      • Display both env file and persisted variables
      • Save changes to persistence file
  2. In lua/hurl/utils.lua:

    • Add functions for reading/writing persistent storage
    • Add function to parse env files into variable format
  3. In test/plugin_spec.lua:

    describe('HurlManageVariable', function()
      it('loads variables from env files')
      it('persists variables between sessions')
      it('displays combined env and persisted variables')
    end)

Implementation Notes:

  • Store persistent variables in JSON format
  • Load env file variables on plugin initialization
  • Merge env file variables with persisted variables in display
  • Handle variable conflicts with user notification

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions