Skip to content
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

new module comma and some updates #704

Merged
merged 4 commits into from
Dec 20, 2023
Merged

new module comma and some updates #704

merged 4 commits into from
Dec 20, 2023

Conversation

fj0r
Copy link
Contributor

@fj0r fj0r commented Dec 20, 2023

update:

  • cwdhist: openeditor changed from alt+e to alt+o
  • docker: pull, push add nerdctl insecure-registry support
  • docker: registry show use curl instead http get (may cause dns resolution problems)
  • git: status table -n changed to table -i

new module: comma

Similar to pwd-module, but supports completion and description through custom data formats

  • , or * need to be exported in order to use , directly
  • Directly execute , to create a new template file or edit an existing file
  • Custom tasks are written in $env.comma and can be nested
  • Generate completions based on the structure of $env.comma
  • You can use closure to customize completion
  • In $env.commax.act of default closure, you can receive parameters after the current position
  • In $env.commax.cmp , you can receive the parameter before the current position

cwdhist: openeditor changed from alt+e to alt+o
docker: pull, push add nerdctl insecure-registry support
docker: registry show use curl instead http get (may cause dns resolution problems)
git: status `table -n` changed to `table -i`

new module: comma

Similar to `pwd-module`, but supports completion and description through custom data formats
- Directly execute `,` to create a new template file or edit an existing configuration
- Custom tasks are written in `$env.comma` and can be nested
- Generate completions based on the structure of `$env.comma`
- You can use closure to customize completion
- In `$env.commax.act` of default closure, you can receive parameters after the current position
- In `$env.commax.cmp` , you can receive the parameter before the current position
@fj0r
Copy link
Contributor Author

fj0r commented Dec 20, 2023

Contents of the default template

$env.commav = {

}
$env.comma = {
    created: { '2023-12-20[3]16:02:56' }
    hello: {
        $env.commax.act: {|x| print $'hello ($x)' }
        $env.commax.dsc: 'hello (x)'
        $env.commax.cmp: {|args| $args}
    }
    open: {
        $env.commax.sub: {
            any: {
                $env.commax.act: {|x| open $x.0}
                $env.commax.cmp: {ls | get name}
                $env.commax.dsc: 'open a file'
            }
            json: {
                $env.commax.act: {|x| open $x.0}
                $env.commax.cmp: {ls *.json | get name}
                $env.commax.dsc: 'open a json file'
            }
        }
        $env.commax.dsc: 'open a file'
    }
    # Nest as you like
    a: {
        b: {
            c: {
                $env.commax.act: {|x| print $x }
                $env.commax.dsc: 'description'
                $env.commax.cmp: {|| ls | get name }
            }
            d: { pwd }
        }
        x: {
            $env.commax.sub: {
                y: {
                    $env.commax.act: {|x| print y}
                    $env.commax.cmp: {|| [y1 y2 y3]}
                    $env.commax.dsc: 'description'
                }
            }
            $env.commax.dsc: 'xxx'
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants