GithubHelp home page GithubHelp logo

retools's Introduction

retools

retools is an EPICS module that contains a few useful EPICS shell commands that use regular expressions. Uses C++11's regexp.

reGrep "pattern"

Prints record names that match the regular expression in pattern. Example:

epics> dbl
ABC:X
ABC:Y
ABC:Z

epics> reGrep "X"
ABC:X

epics> reGrep "[X|Y]"
ABC:X
ABC:Y

reTest "pattern" "value"

Tests a substitution of pattern with value, useful for testing before running reAddAlias or reAddInfo. Example:

epics> dbl
ABC:X
ABC:Y
ABC:Z

epics> reTest "AB(.*):.*$" "$1"
ABC:X C

reAddAlias "pattern" "alias"

Adds an alias to all records that match the regular expression in pattern. Example:

epics> dbl
ABC:X
ABC:Y
ABC:Z

epics> reAddAlias "ABC:(.*)" "DEF:$1"
Alias ABC:X -> DEF:X created
Alias ABC:Y -> DEF:Y created
Alias ABC:Z -> DEF:Z created

epics> dbla
DEF:X -> ABC:X
DEF:Y -> ABC:Y
DEF:Z -> ABC:Z

reAddInfo "pattern" "name" "value"

Adds an info tag to all records that match the regular expression in pattern. Matching groups can be used for value. Example:

epics> dbl
ABC:X
ABC:Y
ABC:Z

epics> reAddInfo "(.*):.*" "prefix" "$1"
ABC:X: added info(prefix, 'ABC')
ABC:Y: added info(prefix, 'ABC')
ABC:Z: added info(prefix, 'ABC')

epics> dbDumpRecord
record(ai,"ABC:X") {
    field(DTYP,"Soft Channel")
    info("prefix","ABC")
}
record(ai,"ABC:Y") {
    field(DTYP,"Soft Channel")
    info("prefix","ABC")
}
record(ai,"ABC:Z") {
    field(DTYP,"Soft Channel")
    info("prefix","ABC")
}

rePutField "pattern" "field" "value"

Sets the value of a particular field to all records that match the regular expression in pattern. Can be used for the VAL field. Example:

epics> dbl
ABC:X
ABC:Y
ABC:Z

epics> rePutField "(.*):.*" "EGU" "units"
ABC:X: put field(EGU, 'units')
ABC:Y: put field(EGU, 'units')
ABC:Z: put field(EGU, 'units')

epics> dbDumpRecord
record(ai,"ABC:X") {
    field(DTYP,"Soft Channel")
    field(EGU,"units")
}
record(ai,"ABC:Y") {
    field(DTYP,"Soft Channel")
    field(EGU,"units")
}
record(ai,"ABC:Z") {
    field(DTYP,"Soft Channel")
    field(EGU,"units")
}

Disabling verbose output

By default, retools has verbose output. To disable it, set the variable reToolsVerbose to 0:

epics> var reToolsVerbose 0
epics>

retools's People

Contributors

brunoseivam avatar jeonghanlee avatar nariox avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

nariox

retools's Issues

Semi-verbose output option

Hi! This is an awesome module, I was about to look into programmatically generating db files with alias definitions, which would have to be kept up to date, when I remembered I had come across your repo :)

Since I have a lot of aliases, reAddAlias output is quite verbose, but simply disabling verbose output for retools feels like it's lacking feedback. Would you be interested in an output option for reAddAlias which simply outputs the number of aliases that it created due to the command? I could implement it, but figured I should ask before putting time into it.

(btw, since you're using c++11 regexes and not introducing new complicated dependencies, do you think there's a chance this module could ever become official? are you interested in pursuing that?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.