src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/edit/store_api.d.elv (about) 1 # Outputs the command history. 2 # 3 # By default, each entry is represented as a map, with an `id` key key for the 4 # sequence number of the command, and a `cmd` key for the text of the command. 5 # If `&cmd-only` is `$true`, only the text of each command is output. 6 # 7 # All entries are output by default. If `&dedup` is `$true`, only the most 8 # recent instance of each command (when comparing just the `cmd` key) is 9 # output. 10 # 11 # Commands are are output in oldest to newest order by default. If 12 # `&newest-first` is `$true` the output is in newest to oldest order instead. 13 # 14 # As an example, either of the following extracts the text of the most recent 15 # command: 16 # 17 # ```elvish 18 # edit:command-history | put [(all)][-1][cmd] 19 # edit:command-history &cmd-only &newest-first | take 1 20 # ``` 21 fn command-history {|&cmd-only=$false &dedup=$false &newest-first| } 22 23 # Inserts the last word of the last command. 24 fn insert-last-word { }