attic-labs / noms

The versioned, forkable, syncable database
Apache License 2.0
7.44k stars 266 forks source link

`noms show` show array indices? #2008

Open kalman opened 8 years ago

kalman commented 8 years ago

When I do noms show http://demo.noms.io/cli-tour::sf-bike-parking I see:

struct Commit {
  parents: Set<Ref<Cycle<0>>>,
  value: Value,
}({
  parents: {
    sha1-5cc85c88ce0ec0175159de9f9d90c46fc2096cb5,
  },
  value: [  // 2,520 items
    Row {
      ADDRESS: "939 ELLIS ST",
      COORDINATES: "ELLIS\n(37.78346622, -122.42177834)",
      LOCATION_NAME: "Bay Area Air Quality Management District (BAAQMD)",
      MO_INSTALLED: "8",
      PLACEMENT: "SW",
      RACKS: "2",
      SPACES: "4",
      STREET_NAME: "ELLIS",
      YR_INSTALLED: "1997",
    },
    Row {
      ADDRESS: "1380 HOWARD ST",
      COORDINATES: "HOWARD\n(37.77445800, -122.41441100)",
      LOCATION_NAME: "San Francisco Department of Public Health",
      MO_INSTALLED: "UK",
      PLACEMENT: "SW",
      RACKS: "1",
      SPACES: "2",
      STREET_NAME: "HOWARD",
      YR_INSTALLED: "1998",
    },
...

The // 2,520 items is nice, what about showing the row indices as well? Strawman:

  value: [  // 2,520 items
    // [0]
    Row {
      ...
    },
    // [1]
    Row {
      ...
    },

@aboodman @arv

aboodman commented 8 years ago

I don't personally feel any desire for this. What made you want this?

kalman commented 8 years ago

Browsing through a list and wondering which element it was so that I could do

noms show http://demo.noms.io/cli-tour::sf-bike-parking.value[42].ADDRESS

or whatever.

kalman commented 8 years ago

And just generally getting a feel of relatively how far through a list I've scrolled.

It's not a big deal but it has > 0 utility for me.

aboodman commented 8 years ago

I see.

Seems reasonable. You could even get fancy and do it every 10th item or something.

On Mon, Jul 11, 2016 at 2:03 PM, Ben Kalman notifications@github.com wrote:

And just generally getting a feel of relatively how far through a list I've scrolled.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/attic-labs/noms/issues/2008#issuecomment-231864178, or mute the thread https://github.com/notifications/unsubscribe/AAE6BDosBTTW_7_1fRo_iVaoQAI3DdAiks5qUq-RgaJpZM4JJwLS .

aboodman commented 8 years ago

An alternate strategy would be to just have HRS include the indices, more like a map:

foo: [
  0: "monkey",
  1: "giraffe",
  ...
]