How to use the visidata.VisiData function in visidata

To help you get started, we’ve selected a few visidata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github saulpw / visidata / visidata / statusbar.py View on Github external
@VisiData.global_api
def warning(vd, s):
    vd.status(s, priority=1)
github saulpw / visidata / visidata / statusbar.py View on Github external
@VisiData.lazy_property
def statusHistory(vd):
    return list()  # list of [priority, statusmsg, repeats] for all status messages ever
github saulpw / visidata / visidata / textsheet.py View on Github external
@VisiData.property
def allErrorsSheet(self):
    return ErrorSheet("errors_all", lines=sum(vd.lastErrors, []))
github saulpw / visidata / plugins / inplace.py View on Github external
@VisiData.api
def addcol_expr(vd, sheet, colidx):
    try:
        c = sheet.addColumn(ColumnExpr("", width=options.default_width), index=colidx)
        oldidx = sheet.cursorVisibleColIndex
        sheet.cursorVisibleColIndex = sheet.visibleCols.index(c)

        expr = sheet.editCell(sheet.cursorVisibleColIndex, -1,
                                completer=CompleteExpr(sheet),
                                updater=lambda val,col=c: col.updateExpr(val))

        c.expr = expr or fail("no expr")
        c.name = expr
        c.width = None
    except (Exception, EscapeException):
        sheet.columns.remove(c)
        sheet.cursorVisibleColIndex = oldidx
github saulpw / visidata / visidata / deprecated.py View on Github external
@VisiData.api
def __call__(vd):
    'Deprecated; use plain "vd"'
    return vd
github saulpw / visidata / visidata / _input.py View on Github external
@VisiData.global_api
def confirm(vd, prompt, exc=ExpectedException):
    yn = vd.input(prompt, value='no', record=False)[:1]
    if not yn or yn not in 'Yy':
        if exc:
            raise exc('disconfirmed')
        warning('disconfirmed')
        return False
    return True
github saulpw / visidata / visidata / sheets.py View on Github external
@VisiData.lazy_property
def allSheetsSheet(vd):
    return SheetsSheet("sheets_all", source=vd.allSheets)
github saulpw / visidata / visidata / undo.py View on Github external
@VisiData.api
def addUndoSetValues(vd, cols, rows):
    oldvals = [(c, r, c.getValue(r)) for c,r in itertools.product(cols, vd.Progress(rows, gerund='doing'))]
    def _undo():
        for c, r, v in oldvals:
            c.setValue(r, v)
    vd.addUndo(_undo)
github saulpw / visidata / visidata / basesheet.py View on Github external
@VisiData.api
def getSheet(vd, sheetname):
    matchingSheets = [x for x in vd.sheets if x.name == sheetname]
    if matchingSheets:
        if len(matchingSheets) > 1:
            vd.status('more than one sheet named "%s"' % sheetname)
        return matchingSheets[0]

    try:
        sheetidx = int(sheetname)
        return vd.sheets[sheetidx]
    except ValueError:
        pass

    if sheetname == 'options':
        vs = self.optionsSheet
        vs.reload()
github saulpw / visidata / visidata / mainloop.py View on Github external
@VisiData.api
def draw(self, scr, *sheets):
    'Redraw full screen.'
    for sheet in sheets:
        sheet._scr = scr
        try:
            sheet.draw(scr)
        except Exception as e:
            self.exceptionCaught(e)

    self.drawLeftStatus(scr, sheets[0])
    self.drawRightStatus(scr, sheets[0])  # visible during this getkeystroke