<<>> <> <> <> <> <<>> DIRECTORY Commander, CommanderOps, IO, PFS, Profiles, Rope; TestProfiles: CEDAR PROGRAM IMPORTS Commander, CommanderOps, IO, PFS, Profiles ~ BEGIN ROPE: TYPE = Rope.ROPE; profile: Profiles.Profile ¬ NIL; CreateProfile: Commander.CommandProc ~ { <> <> tokens: LIST OF ROPE ¬ CommanderOps.ParseToList[cmd: cmd].list; IF tokens=NIL THEN RETURN[$Failure, "Can't find any filenames\n"]; profile ¬ Profiles.Create[tokens ! PFS.Error => {msg ¬ error.explanation ; GOTO Oops} ]; <> EXITS Oops => RETURN [$Failure]; }; ProfileLine: Commander.CommandProc ~ { <> <> IF profile=NIL THEN RETURN [$Failure, "Can't find profile on property list"]; FOR tokens: LIST OF ROPE ¬ CommanderOps.ParseToList[cmd: cmd].list, tokens.rest UNTIL tokens=NIL DO IO.PutF[stream: cmd.out, format: "Key: %g, Value: %g\n", v1: [rope[tokens.first]], v2: [rope[Profiles.Line[profile, tokens.first, "(not found)"]]]]; ENDLOOP; }; Init: PROC ~ { Commander.Register[key: "CreateProfile", proc: CreateProfile, doc: "Create a profile from the list of filenames on the command line\n"]; Commander.Register[key: "ProfileLine", proc: ProfileLine, doc: "Look up the keys on the command line in the profile stored on the command tool's property list\n"]; }; Init[]; END.