mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 07:00:37 +02:00
added real index column to history (#4756)
This commit is contained in:
@ -53,8 +53,19 @@ impl Command for History {
|
||||
if let Ok(contents) = contents {
|
||||
Ok(contents
|
||||
.lines()
|
||||
.map(move |x| Value::String {
|
||||
val: decode_newlines(x),
|
||||
.enumerate()
|
||||
.map(move |(index, command)| Value::Record {
|
||||
cols: vec!["command".to_string(), "index".to_string()],
|
||||
vals: vec![
|
||||
Value::String {
|
||||
val: decode_newlines(command),
|
||||
span: head,
|
||||
},
|
||||
Value::Int {
|
||||
val: index as i64,
|
||||
span: head,
|
||||
},
|
||||
],
|
||||
span: head,
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
|
Reference in New Issue
Block a user