3 | | = Interactivity Use Cases = |
| 3 | = Use Cases Implemented = |
| 4 | |
| 5 | === Uninstall when port has dependents === |
| 6 | Desc: When uninstalling a port, if the port has dependents ask the user for confirmation before uninstalling. |
| 7 | |
| 8 | Message: A warning message making it clear that some other ports are getting broken. A list of all those ports will be displayed. |
| 9 | |
| 10 | Question type: A yes/no question is right for such a case. |
| 11 | |
| 12 | Example- |
| 13 | {{{ |
| 14 | $> port uninstall foobar |
| 15 | The following ports will break: |
| 16 | brofoo @0.19.1_0 |
| 17 | foobro @2.2.6_0 |
| 18 | Continue? [y/N]: y |
| 19 | Warning: Uninstall forced. Proceeding despite dependencies. |
| 20 | ---> Deactivating foobar @1.14_0 |
| 21 | ---> Cleaning foobar |
| 22 | ---> Uninstalling foobar @1.14_0 |
| 23 | ---> Cleaning foobar |
| 24 | $> |
| 25 | }}} |
| 26 | |
| 27 | |
| 28 | === Uninstall using -—follow-dependencies === |
| 29 | Desc: When a user uninstalls using the flag —-follow-dependencies, ask for confirmation. |
| 30 | |
| 31 | Message: A list of all the dependencies that will be uninstalled will be displayed. |
| 32 | |
| 33 | Question type: A yes/no question makes sense here. The user will confirm the uninstall action or have a chance of aborting. A timeout can be used here too. |
| 34 | |
| 35 | Example- |
| 36 | {{{ |
| 37 | $> port uninstall —-follow-dependencies foobar |
| 38 | The following packages will be uninstalled: |
| 39 | foobar @0.0.1 +xzy |
| 40 | barfoo @0.0.2 +xzy |
| 41 | foba @0.1 |
| 42 | Continue? [Y/n]: Y |
| 43 | ---> Uninstalling foobar @0.0.1 +xzy |
| 44 | ---> Uninstalling barfoo @0.0.2 +xzy |
| 45 | ——-> Uninstalling foba @0.1 |
| 46 | $> |
| 47 | }}} |
| 48 | |
| 49 | |
| 50 | === Ambiguous uninstall === |
| 51 | Desc: When uninstalling a port if the user supplies an ambiguous name, list all the variants and ask to select the ones that should be uninstalled. |
| 52 | |
| 53 | Message: A list of all variants related to the ambiguous name provided. |
| 54 | |
| 55 | Question type: A multiple choice question is what is required in this case. The user will be able to select the ones they want to uninstall. The selected options may be highlighted. Then pressing enter proceeds with the uninstall. |
| 56 | |
| 57 | Example- |
| 58 | {{{ |
| 59 | $> port uninstall foobar |
| 60 | "foobar" is ambiguous. Which of the following ports do you want to uninstall? |
| 61 | (1) foobar @0.0.1 +xzy |
| 62 | (2) foobar @0.0.1 +xyz |
| 63 | (3) foobar @0.0.3 |
| 64 | Enter a space separated string of choices to select the ports to uninstall: 1 3 |
| 65 | ---> Uninstalling foobar @0.0.1 +xzy |
| 66 | ---> Uninstalling foobar @0.0.3 |
| 67 | $> |
| 68 | }}} |
| 69 | |
| 70 | |
| 71 | === Ambiguous activate === |
| 72 | Desc: When port activate command is run ambiguously, give a list of ports to the user to choose from. |
| 73 | |
| 74 | Message: A list of all the port versions/variants of the port name given. |
| 75 | |
| 76 | Question type: A single choice question having multiple options is what is required in this case. The user is asked to choose one of the options. |
| 77 | |
| 78 | Example- |
| 79 | {{{ |
| 80 | $> port activate foobar |
| 81 | The following variants of foobar exist: |
| 82 | foobar @0.0.1 +xzy |
| 83 | foobar @0.0.2 +xzy |
| 84 | foobar @0.1 |
| 85 | Type a number to select the variant to activate: 2 |
| 86 | ---> foobar @0.0.2 +xzy activated. |
| 87 | $> |
| 88 | }}} |
| 89 | |
| 90 | === Rebuilding in rev-upgrade === |
| 91 | Desc: Before rebuilding any port in rev-upgrade the user will be asked for confirmation. |
| 92 | |
| 93 | Message: A list of ports that will be rebuilt along with some detail(not sure) about the linking errors. If the user chooses to answer no, display the message "You can always run 'port rev-upgrade' later to fix this". |
| 94 | |
| 95 | Question type: A yes/no question seems to handle the situation well. The whole list will be rebuilt as asking for each port might break the process of rev-upgrade. |
| 96 | |
| 97 | Example- |
| 98 | {{{ |
| 99 | $> port rev-upgrade |
| 100 | The following ports will be rebuilt: |
| 101 | boofar @0.0.1 +xzy |
| 102 | barfoo @0.0.2 +xzy |
| 103 | foba @0.1 |
| 104 | Continue? [Y/n]: Y |
| 105 | ---> Rebuilding boofar @0.0.1 +xzy |
| 106 | ---> Rebuilding barfoo @0.0.2 +xzy |
| 107 | ---> Rebuilding foba @0.1 |
| 108 | $> |
| 109 | }}} |
| 110 | |
| 111 | === Apt-get like behaviour === |
| 112 | Desc: When installing a port, list all the dependencies and ask the user for confirmation just like apt-get does. |
| 113 | |
| 114 | Message: A list of all the dependencies. |
| 115 | |
| 116 | Question type: A continue/abort question to give the options of continuing with the installation or aborting it. This could even use a 10s timeout, giving an option to abort during the timeout and continuing automatically after the time is out. |
| 117 | |
| 118 | Example- |
| 119 | {{{ |
| 120 | $> port install foobar |
| 121 | The following dependencies of foobar will be installed: |
| 122 | boofar @0.0.1 +xzy |
| 123 | barfoo @0.0.2 +xzy |
| 124 | foba @0.1 |
| 125 | Continue? [Y/n]: Y |
| 126 | ---> Installing boofar @0.0.1 +xzy |
| 127 | ---> Installing barfoo @0.0.2 +xzy |
| 128 | ---> Installing foba @0.1 |
| 129 | ---> Installing foobar |
| 130 | $> |
| 131 | }}} |
| 132 | |
| 133 | |
| 134 | = Other Use Cases = |
54 | | === Dependents getting broken === |
55 | | Desc: When uninstalling a port, if ports that depend on it are getting broken |
56 | | ask the user for confirmation. |
57 | | |
58 | | Message: A warning message making it clear that some other ports are getting broken. A list of all those ports will be displayed. |
59 | | |
60 | | Question type: A yes/no question is right for such a case. |
61 | | |
62 | | Example- |
63 | | {{{ |
64 | | $> port uninstall foobar |
65 | | The following dependents of foobar will be broken: |
66 | | boofar @0.0.1 +xzy |
67 | | barfoo @0.0.2 +xzy |
68 | | foba @0.1 |
69 | | Continue? [y/N]: y |
70 | | ---> Uninstalling foobar |
71 | | $> |
72 | | }}} |
73 | | |
74 | | |
75 | | === Uninstall using -—follow-dependencies === |
76 | | Desc: When a user uninstalls using the flag —-follow-dependencies, ask for confirmation. |
77 | | |
78 | | Message: A list of all the dependencies that will be uninstalled will be displayed. |
79 | | |
80 | | Question type: A yes/no question makes sense here. The user will confirm the uninstall action or have a chance of aborting. A timeout can be used here too. |
81 | | |
82 | | Example- |
83 | | {{{ |
84 | | $> port uninstall —follow-dependencies foobar |
85 | | The following packages will be uninstalled: |
86 | | foobar @0.0.1 +xzy |
87 | | barfoo @0.0.2 +xzy |
88 | | foba @0.1 |
89 | | Continue? [Y/n]: Y |
90 | | ---> Uninstalling foobar @0.0.1 +xzy |
91 | | ---> Uninstalling barfoo @0.0.2 +xzy |
92 | | ——-> Uninstalling foba @0.1 |
93 | | $> |
94 | | }}} |
95 | | |
96 | | |
97 | | === Variant specific dependency (Low-priority) === |
98 | | Desc: When installing a port that requires a dependency to have a certain variant, but this variant is not set. Ask the user if it should reinstall the dependency with that variant. This interaction is currently marked low priority. |
| 185 | === Variant specific dependency === |
| 186 | Desc: When installing a port that requires a dependency to have a certain variant, but this variant is not set. Ask the user if it should reinstall the dependency with that variant. |
134 | | = Use Cases Completed = |
135 | | |
136 | | === Ambiguous uninstall === |
137 | | Desc: When uninstalling a port if the user supplies an ambiguous name, list all the variants and ask to select the ones that should be uninstalled. |
138 | | |
139 | | Message: A list of all variants related to the ambiguous name provided. |
140 | | |
141 | | Question type: A multiple choice question is what is required in this case. The user will be able to select the ones they want to uninstall. The selected options may be highlighted. Then pressing enter proceeds with the uninstall. |
142 | | |
143 | | Example- |
144 | | {{{ |
145 | | $> port uninstall foobar |
146 | | "foobar" is ambiguous. Which of the following ports do you want to uninstall? |
147 | | (1) foobar @0.0.1 +xzy |
148 | | (2) foobar @0.0.1 +xyz |
149 | | (3) foobar @0.0.3 |
150 | | Enter a space separated string of choices to select the ports to uninstall: 1 3 |
151 | | ---> Uninstalling foobar @0.0.1 +xzy |
152 | | ---> Uninstalling foobar @0.0.3 |
153 | | $> |
154 | | }}} |
155 | | |
156 | | |
157 | | === Ambiguous activate === |
158 | | Desc: When port activate command is run ambiguously, give a list of ports to the user to choose from. |
159 | | |
160 | | Message: A list of all the port versions/variants of the port name given. |
161 | | |
162 | | Question type: A single choice question having multiple options is what is required in this case. The user is asked to choose one of the options. |
163 | | |
164 | | Example- |
165 | | {{{ |
166 | | $> port activate foobar |
167 | | The following variants of foobar exist: |
168 | | foobar @0.0.1 +xzy |
169 | | foobar @0.0.2 +xzy |
170 | | foobar @0.1 |
171 | | Type a number to select the variant to activate: 2 |
172 | | ---> foobar @0.0.2 +xzy activated. |
173 | | $> |
174 | | }}} |
175 | | |
176 | | === Rebuilding in rev-upgrade === |
177 | | Desc: Before rebuilding any port in rev-upgrade the user will be asked for confirmation. |
178 | | |
179 | | Message: A list of ports that will be rebuilt along with some detail(not sure) about the linking errors. If the user chooses to answer no, display the message "You can always run 'port rev-upgrade' later to fix this". |
180 | | |
181 | | Question type: A yes/no question seems to handle the situation well. The whole list will be rebuilt as asking for each port might break the process of rev-upgrade. |
182 | | |
183 | | Example- |
184 | | {{{ |
185 | | $> port rev-upgrade |
186 | | The following ports will be rebuilt: |
187 | | boofar @0.0.1 +xzy |
188 | | barfoo @0.0.2 +xzy |
189 | | foba @0.1 |
190 | | Continue? [Y/n]: Y |
191 | | ---> Rebuilding boofar @0.0.1 +xzy |
192 | | ---> Rebuilding barfoo @0.0.2 +xzy |
193 | | ---> Rebuilding foba @0.1 |
194 | | $> |
195 | | }}} |
196 | | |
197 | | === Apt-get like behaviour === |
198 | | Desc: When installing a port, list all the dependencies and ask the user for confirmation just like apt-get does. |
199 | | |
200 | | Message: A list of all the dependencies. |
201 | | |
202 | | Question type: A continue/abort question to give the options of continuing with the installation or aborting it. This could even use a 10s timeout, giving an option to abort during the timeout and continuing automatically after the time is out. |
203 | | |
204 | | Example- |
205 | | {{{ |
206 | | $> port install foobar |
207 | | The following dependencies of foobar will be installed: |
208 | | boofar @0.0.1 +xzy |
209 | | barfoo @0.0.2 +xzy |
210 | | foba @0.1 |
211 | | Continue? [Y/n]: Y |
212 | | ---> Installing boofar @0.0.1 +xzy |
213 | | ---> Installing barfoo @0.0.2 +xzy |
214 | | ---> Installing foba @0.1 |
215 | | ---> Installing foobar |
216 | | $> |
217 | | }}} |
218 | | |
219 | | = Implementation Details = |
220 | | |
221 | | === ui_* calls === |
222 | | Under ui_ask_ namespace: |
223 | | |
224 | | ui_ask_yesno: deals with all the continue/abort type questions |
225 | | |
226 | | ui_ask_singlechoice: deals with all the single choice selection questions |
227 | | |
228 | | ui_ask_multichoice: deals with questions that offer many more than one selections |
229 | | |
230 | | ui_timeout: deals with yes/no questions that may have better functionality with timeouts |
231 | | |
| 222 | === Sudo === |
| 223 | Desc: When a command is entered that requires elevated privileges and user has failed to provide them, ask the user if they wish to run the command as su. |
| 224 | |
| 225 | Message: A message explaining that the command requires to be run "sudo" prefixed. |
| 226 | |
| 227 | Question type: A yes/no question asking if the user wants to give sudo permission or not. |
| 228 | |
| 229 | Example- |
| 230 | {{{ |
| 231 | $> port install foobar |
| 232 | Note: 'Install' action requires elevated privileges. |
| 233 | Do you wish to run this as sudo? [Y/n]: y |
| 234 | ---> Installing foobar @0.0.1 |
| 235 | $> |
| 236 | }}} |
| 237 | |