Skip to content

Instantly share code, notes, and snippets.

View victor-almanzar's full-sized avatar

Victor Almanzar victor-almanzar

  • Alexandria, VA
  • 01:34 (UTC -04:00)
View GitHub Profile
def str-cols [] {
let head = $in
$head | columns | where {|c| ($head | get $c | describe) == 'string' }
}
def pad-strings [] {
let t = $in
$t | first | str-cols | reduce -f $t {|c, acc|
let w = ($acc | get $c | each {|s| $s | str length} | math max)
$acc | update $c {|| $in | fill --width $w }