Commit 5232856229f67c785b43ee8edfa86e40d394e488
- Diff rendering mode:
- inline
- side by side
src/gaze.mod
(16 / 13)
|   | |||
| 143 | 143 | PROCEDURE dependencies(parse : Message.Parse); | |
| 144 | 144 | CONST | |
| 145 | 145 | recast = '/var/lib/sorcery/codex/test/gnome2-libs/glib2 is forcing a recast of pkgconfig'; | |
| 146 | noColors = "| sed 's/\x1b[^m]*m//g' "; (* strip colors *) | ||
| 146 | noColors = "| sed 's/\x1b[^m]*m//g' "; (* strip colors *) | ||
| 147 | 147 | modDepends = "| sed s/\(depends\)//g "; (* modify (depends) *) | |
| 148 | 148 | modOptional = "| sed s/\ \(optional\)/*/g "; (* Modify (optional) *) | |
| 149 | modSub = "| sed s/-sub//g "; (* Modify -sub *) | ||
| 149 | modSuggest = "| sed s/\ \(suggest\)/\$/g "; (* Modify (suggest) *) | ||
| 150 | modSub = "| sed 's/-sub//g' "; (* Modify -sub *) | ||
| 150 | 151 | modSpaces = "| sed 's/^ *//;s/ *$//;s/ \{1,\}/ /g' "; (* delete extra spaces *) | |
| 151 | FILTER = noColors+modDepends+modOptional+modSub+modSpaces; | ||
| 152 | FILTER = noColors+modDepends+modOptional+modSuggest+modSub+modSpaces; | ||
| 152 | 153 | ||
| 153 | 154 | writeFIFO = p6Fifo.writeFIFO; | |
| 154 | 155 | readFIFO = p6Fifo.readFIFO; | |
| 155 | |||
| 156 | flags = StreamFile.read+StreamFile.old; | ||
| 156 | 157 | VAR | |
| 157 | command, result : ARRAY[0..4095] OF CHAR; (* bufferSize from p6Fifo *) | ||
| 158 | target, null: ARRAY [0..99] OF CHAR; | ||
| 159 | a, pos : CARDINAL; | ||
| 158 | command, result, target, null : ARRAY[0..4095] OF CHAR; (* bufferSize from p6Fifo *) | ||
| 159 | (* target, null: ARRAY [0..499] OF CHAR; *) | ||
| 160 | a, pos, exit : CARDINAL; | ||
| 160 | 161 | found, valid : BOOLEAN; | |
| 161 | |||
| 162 | debugging : BOOLEAN; | ||
| 163 | file : StreamFile.ChanId; | ||
| 164 | res: StreamFile.OpenResults; | ||
| 162 | 165 | BEGIN | |
| 166 | debugging := TRUE; | ||
| 163 | 167 | (* Initialize some variables *) | |
| 164 | 168 | command := ""; target := ""; result := ""; | |
| 165 | 169 | util.CmdUsed(parse); | |
| … | … | ||
| 176 | 176 | END; | |
| 177 | 177 | (* Delete leading spaces *) | |
| 178 | 178 | StringParse.TrimLeft(target); | |
| 179 | |||
| 179 | 180 | (* We only accept one word, look for a space, if there, remove it and anything that follows.*) | |
| 180 | 181 | Strings.FindNext(" ", target, 1, found, pos); | |
| 181 | 182 | IF found THEN Strings.Extract(target, 0, pos, target) END; | |
| … | … | ||
| 189 | 189 | END; | |
| 190 | 190 | ||
| 191 | 191 | (* Everything looks good *) | |
| 192 | |||
| 193 | |||
| 194 | FormStr.print(command, "echo $(gaze -q dependencies -c %s 2) %s", target, FILTER); | ||
| 192 | FormStr.print(command, 'echo $(gaze -q dependencies -c "%s" 2) %s ', target, FILTER); | ||
| 195 | 193 | writeFIFO(command); | |
| 196 | readFIFO(result); | ||
| 197 | |||
| 194 | readFIFO(result); | ||
| 195 | |||
| 198 | 196 | (* Not sure how to handle this otherwise *) | |
| 199 | 197 | Strings.FindNext(recast, result, 0, found, pos); | |
| 200 | 198 | IF found THEN |

