Piping to bbresults

107 views
Skip to first unread message

Christopher Finazzo

unread,
Dec 19, 2023, 4:40:42 PM12/19/23
to BBEdit Talk
I am consolidating a set of proofreading scripts into a Makefile that includes a "proof" rule. This rule calls each of the underlying scripts - and Aspell - in sequence. At the moment, running these will print output to the screen, but I would like to go one step further.

As these are "interactive" scripts, which return a text UI when run, is it possible to pass the results to bbresults and present matching items in a differences window?

The end result would look similar to the following:

proof:
    duplicates.sh
    passive-voice.sh
    weasel-words.sh
    aspell check $document


I have done something similar with a function bbshellcheck, which has the following form:

bbshellcheck {
    shellcheck -f gcc "$@" | bbresults
}


On paper, this makes sense. However, it isn't working exactly as I expect -- Is this the wrong approach, or am I missing something obvious? 

jj

unread,
Dec 20, 2023, 4:42:29 AM12/20/23
to BBEdit Talk
Hi Christopher,

You could aggregate your patterns into a single regular expression and use it directly from BBEdit
with the benefit of result sets, multi-file searches, matches highlighting, etc.

Here is an unrolled example pattern:

(?xx)
(?i)                                        (?# Case insensitive.)
(?n)                                        (?# No auto capture.)
\b
(
    (                                       (?#: Weasel words.)
        zzz
        |very
        |vast
        |various
        |tiny
        |surprisingly
        |substantially
        |significantly
        |several
        |remarkably
        |relatively
        |quite
        |mostly
        |many
        |largely
        |interestingly
        |huge
        |few
        |fairly
        |extremely
        |excellent
        |exceedingly
        |completely
        |clearly
        |((are|is) a number)
    )
|
    (                                       (?#: Passive voices.)
        zzz
        |wrung
        |written
        |woven
        |wound
        |worn
        |won
        |woken
        |withstood
        |withheld
        |wept
        |wed
        |upset
        |upheld
        |understood
        |trodden
        |torn
        |told
        |thrust
        |thrown
        |thrived
        |thought
        |taught
        |taken
        |swung
        |swum
        |sworn
        |swollen
        |swept
        |sunk
        |sung
        |stunk
        |stung
        |stuck
        |strung
        |struck
        |striven
        |stridden
        |stood
        |stolen
        |spun
        |sprung
        |spread
        |spoken
        |split
        |spit
        |spilt
        |spent
        |sped
        |sown
        |sought
        |sold
        |smitten
        |slung
        |slit
        |slid
        |slept
        |slain
        |shut
        |shrunk
        |shown
        |shot
        |shorn
        |shone
        |shod
        |shed
        |shaven
        |shaken
        |sewn
        |set
        |sent
        |seen
        |sawn
        |sat
        |said
        |rung
        |run
        |risen
        |ridden
        |rid
        |read
        |quit
        |put
        |proven
        |pled
        |paid
        |overthrown
        |overtaken
        |overdone
        |overcome
        |mown
        |mistaken
        |misspelt
        |met
        |meant
        |made
        |lost
        |lighted
        |let
        |lent
        |left
        |led
        |learnt
        |leapt
        |lain
        |laid
        |known
        |knit
        |knelt
        |kept
        |hurt
        |hung
        |hit
        |hidden
        |held
        |heard
        |grown
        |ground
        |gotten
        |gone
        |given
        |frozen
        |found
        |fought
        |forsaken
        |forgotten
        |forgiven
        |foregone
        |forbidden
        |flung
        |flown
        |fled
        |fit
        |felt
        |fed
        |fallen
        |eaten
        |dug
        |drunk
        |driven
        |dreamt
        |drawn
        |done
        |dived
        |dealt
        |cut
        |crept
        |cost
        |come
        |clung
        |chosen
        |caught
        |cast
        |burst
        |burnt
        |built
        |brought
        |broken
        |broadcast
        |bred
        |bound
        |bought
        |born
        |blown
        |bled
        |bitten
        |bidden
        |bid
        |bet
        |beset
        |bent
        |begun
        |been
        |become
        |beat
        |awoken
    )
|
    (?P<DUPLICATE>\p{L}{2,})\s+(?P=DUPLICATE)       (?#: Duplicate words.)
)
\b

HTH

Jean Jourdain

Christopher Finazzo

unread,
Dec 21, 2023, 11:23:21 AM12/21/23
to BBEdit Talk
My initial inclination was to use a Makefile because it would mean typing less and is itself portable elsewhere.

Thinking about this a bit more, it occurs to me that it may be easier to use the Scripts menu to access these items. Without modification, I presume any results would go to STDOUT - perhaps it could instead go to bbresults? (and a results browser)

Ignore the fact that the example uses Python, I was merely thinking about what the steps involved might look like.
Reply all
Reply to author
Forward
0 new messages