├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── .gitignore
├── .gitmodules
├── .travis.yml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── autoload
├── check.vim
└── load_function.vim
├── doc
└── jira-vim.txt
├── ftplugin
├── jiraboardview.vim
├── jiraissueview.vim
├── jirakanbanboardview.vim
├── jirascrumboardview.vim
├── jirasearchview.vim
└── jirasprintview.vim
├── jiravim.svg
├── plugin
├── boardopen.vim
├── issueopen.vim
├── loadmore.vim
├── returntoboard.vim
├── searchopen.vim
├── selectissue.vim
├── selectsprint.vim
├── setup.vim
└── sprintopen.vim
├── python
├── __init__.py
├── boards
│ ├── __init__.py
│ ├── more.py
│ └── open.py
├── common
│ ├── __init__.py
│ ├── board.py
│ ├── connection.py
│ ├── issue.py
│ ├── kanbanBoard.py
│ ├── scrumBoard.py
│ ├── search.py
│ ├── sessionObject.py
│ └── sprint.py
├── issues
│ ├── __init__.py
│ └── open.py
├── search
│ ├── __init__.py
│ ├── more.py
│ └── open.py
├── sprints
│ ├── __init__.py
│ ├── more.py
│ └── open.py
└── util
│ ├── __init__.py
│ ├── drawUtil.py
│ ├── formatters.py
│ ├── itemCategorizer.py
│ ├── itemExtractor.py
│ └── pip_check.py
├── requirements.txt
├── syntax
├── jiraboardview.vim
├── jiraissueview.vim
├── jirakanbanboardview.vim
├── jirascrumboardview.vim
└── jirasprintview.vim
└── test
├── boardcolumnordering.vader
├── boardissueordering.vader
├── headlessissuereturn.vader
├── loadmorebacklog.vader
├── loadmoreinsprint.vader
├── openboardwithoutsuffix.vader
├── openissue.vader
├── openissuesp.vader
├── openissuewithformatting.vader
├── opensearch.vader
├── opensecondboard.vader
├── openspaceboard.vader
├── opentestboard.vader
├── opentestboardnosp.vader
├── returntoboard.vader
└── returntoboardsplit.vader
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | plugin/credentials.vim
2 |
3 | # Python byte-compiled, DLL files
4 | __pycache__/
5 | *.py[cod]
6 |
7 | # Tags for documentation
8 | doc/tags
9 |
10 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "tabular"]
2 | path = tabular
3 | url = https://github.com/godlygeek/tabular
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: python
2 | os: linux
3 | dist: xenial
4 | python: 3.5
5 |
6 | # Email is burner.a5c67606@tryninja.io
7 | # Access key is 9kAJ0LfQihsVjZ8cfM8eED55
8 |
9 | before_script: |
10 | vim --version
11 | python --version
12 | pip --version
13 | pip list
14 | git clone https://github.com/junegunn/vader.vim.git
15 |
16 | script: |
17 | vim -Nu <(cat <
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # jira-vim
2 |
3 | [](https://app.codacy.com/app/paul.kassianik/jira-vim?utm_source=github.com&utm_medium=referral&utm_content=paulkass/jira-vim&utm_campaign=Badge_Grade_Settings)
4 | [](https://travis-ci.org/paulkass/jira-vim)
5 | [](https://gitter.im/jira-vim/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
6 | [](./LICENSE)
7 |
8 | Jira-vim is a way to view your JIRA setup without the bloat of the JIRA UI.
9 |
10 | Imagine browsing Jira on your computer. All those buttons, animations, and
11 | fancy UI magic that you don't really need are really slowing down your
12 | computer. It's not improving your productivity, on the contrary it makes you
13 | wait and distract yourself while it loads features you'll never need! So I
14 | created this: an attempt at de-bloating Jira by getting rid of the UI and using
15 | the standard Vim environment that we know and love to display data that we
16 | obtain from the API.
17 |
18 |
19 |
20 |
21 |
22 |
23 | ## Current Status: Working on the beta version
24 |
25 | Ahoy, I compiled a tentative checklist of the stuff that will need to be done for the beta release. This checklist is a subset of all the stuff that will be done for the beta, so all the stuff here *will* be done, but this isn't necessarily the exhaustive list of all the things that will be included in the beta release. This also only includes new features, but not any tech debt tasks or technical housekeeping. Here it is:
26 |
27 | - [x] Search Functionality
28 | - [ ] Differentiate between various Issue types
29 | - [ ] Colored syntax highlights
30 | - [x] View issues assigned to you
31 | - [ ] Update issue fields
32 | - [ ] Creating new issues
33 |
34 | If you have anything to suggest, please let me know!
35 |
36 | You can also see what I'm working on right now by looking at [this github project](https://github.com/paulkass/jira-vim/projects/2).
37 |
38 | Also, it will take me a long time to go through each of these checkboxes one by one and make them, so if you have a feature that you particularly like, I encourage you to [contribute](#contributing).
39 |
40 | ## Installation
41 |
42 | With Pathogen, use:
43 |
44 | cd ~/.vim/bundle
45 | git clone https://github.com/paulkass/jira-vim
46 |
47 | With Vim-Plug, use:
48 |
49 | Plug 'paulkass/jira-vim', { 'do': 'pip install -r requirements.txt' }
50 |
51 |
52 | ### Dependencies on Python
53 |
54 | Compile Vim with python3 for this plugin to function properly.
55 |
56 | If you didn't use Plug, then install the `requirements.txt` file with pip. Usually the command is
57 |
58 | pip install -r requirements.txt
59 |
60 | ## Documentation
61 |
62 | I think I put most of the good stuff into `:help jiravim`, so definitely check that out for information about the commands and how to get the show on the road.
63 |
64 | Once you got the environment set up, here is a basic workflow:
65 |
66 | #### Basic Workflow
67 |
68 | * Open your Kanban board with `:JiraVimBoardOpen `.
69 | * Scroll up and down through the issues, and find one you would like to look at.
70 | * Open the issue with `:JiraVimSelectIssueNosp`.
71 | * Look at the issue, make notes about how wonderful your Product Manager is for writing detailed specs.
72 | * You've had enough, you want to look at the other issues that the team must complete, so you return with `:JiraVimReturn`.
73 |
74 | I will try to do my best to be as backward compatible as possible moving forward, but I can make no guarantees.
75 |
76 | ## Please Leave Feedback
77 |
78 | If you do indeed try this plugin, please please please leave some feedback. I'm not the most experienced programmer, so if you have **any** comment or suggestion, either open an issue or send me an email at leonardthesalmon@protonmail.com. I will read all of your feedback (I promise).
79 |
80 | ## Contributing
81 |
82 | Jira is a huge project, and many people use different parts of it. Doing this alone, for me, is a huge task, so I appreciate any help that comes by!
83 |
84 | (You still have to read this boring text first though 😞: [Contributor Guidelines](./CONTRIBUTING.md))
85 |
86 | ### Testing
87 |
88 | The project uses the [vader.vim](https://github.com/junegunn/vader.vim) plugin for intergration testing. Run
89 |
90 | vim -Nc "Vader! test/*"
91 |
92 | from the project root directory. Each pull request is tested with Travis CI and Codacy as well.
93 |
94 | ## ❤️❤️❤️ If you like this ...
95 |
96 | Please consider giving it a rating at [https://www.vim.org/scripts/script.php?script_id=5800](https://www.vim.org/scripts/script.php?script_id=5800)
97 |
98 | And please consider contributing to the project.
99 |
--------------------------------------------------------------------------------
/autoload/check.vim:
--------------------------------------------------------------------------------
1 |
2 |
3 | function! check#CheckStorageSession()
4 |
5 | " Check that credential variables are set
6 | if !exists("g:jiraVimDomainName")
7 | throw "Please set 'g:jiraVimDomainName'. Refer to the 'jiravim-credentials' help tag for more information."
8 | endif
9 |
10 | if !exists("g:jiraVimEmail")
11 | throw "Please set 'g:jiraVimEmail'. Refer to the 'jiravim-credentials' help tag for more information."
12 | endif
13 |
14 | if !exists("g:jiraVimToken")
15 | throw "Please set 'g:jiraVimToken'. Refer to the 'jiravim-credentials' help tag for more information."
16 | endif
17 |
18 | " Invert the values of 0 and 1 since we want to only do something if the
19 | " object does not exist
20 | let l:storage_exists = py3eval("0 if 'sessionStorage' in {**globals(), **locals()} else 1")
21 | if l:storage_exists
22 | call load_function#LoadSessionStorage()
23 | endif
24 | endfunction
25 |
--------------------------------------------------------------------------------
/autoload/load_function.vim:
--------------------------------------------------------------------------------
1 |
2 | function! load_function#LoadSessionStorage()
3 | " Add the python package directory to path
4 | python3 from python.common.sessionObject import SessionObject
5 |
6 | " Weird indent so Python indents don't act weird
7 | python3 << EOF
8 | sessionStorage = SessionObject()
9 | EOF
10 |
11 | endfunction
12 |
--------------------------------------------------------------------------------
/doc/jira-vim.txt:
--------------------------------------------------------------------------------
1 | jira-vim.txt For Vim version 8.0 Last Change: 2019 June 19
2 |
3 | *jira-vim* *jiravim*
4 |
5 | _____________ ___ ______ ~
6 | ______ /__(_)____________ _ __ | / /__(_)______ ___ ~
7 | ___ _ /__ /__ ___/ __ `/________ | / /__ /__ __ `__ \~
8 | / /_/ / _ / _ / / /_/ /_/_____/_ |/ / _ / _ / / / / / ~
9 | \____/ /_/ /_/ \__,_/ _____/ /_/ /_/ /_/ /_/ ~
10 |
11 | ================================================================================
12 | CONTENTS *jiravim-contents*
13 |
14 | 1. Introduction ........................................... |jiravim-intro|
15 | 2. Installation .................................... |jiravim-installation|
16 | 3. Setup .................................................. |jiravim-setup|
17 | 4. Commands ............................................ |jiravim-commands|
18 | 5. Filetypes .......................................... |jiravim-filetypes|
19 | a. Keybind Guide ......................... |jiravim-filetypes-keybinds|
20 | 6. License .............................................. |jiravim-license|
21 | 7. Contact .............................................. |jiravim-contact|
22 |
23 | ================================================================================
24 | INTRODUCTION *jiravim-intro*
25 |
26 | Jira-vim is a way to view your JIRA setup without the bloat of the JIRA UI.
27 |
28 | Imagine browsing Jira on your computer. All those buttons, animations, and
29 | fancy UI magic that you don't really need are really slowing down your
30 | computer. It's not improving your productivity, on the contrary it makes you
31 | wait and distract yourself while it loads features you'll never need! So I
32 | created this: an attempt at de-bloating Jira by getting rid of the UI and using
33 | the standard Vim environment that we know and love to display data that we
34 | obtain from the API.
35 |
36 | ================================================================================
37 | INSTALLATION *jiravim-install* *jiravim-installation*
38 |
39 | With Pathogen, use: >
40 | cd ~/.vim/bundle/
41 | git clone https://github.com/paulkass/jira-vim
42 |
43 | With Vim-Plug, use: >
44 | Plug 'paulkass/jira-vim', { 'do': 'pip install -r requirements.txt' }
45 |
46 | Checks will be performed on startup.
47 |
48 | ================================================================================
49 | SETUP *jiravim-setup*
50 |
51 | Many of the steps described in this guide aren't necessary for many systems.
52 | This is the full from-scratch installation procedure after plugin installation.
53 | Instead, the plugin will check that all of these items are complete at startup
54 | and let you know if something is missing. It will also refer you to the
55 | appropriate section of this guide for instructions on fixing the particular
56 | issue.
57 |
58 | If this guide doesn't help you with your issue, feel free to contact me at
59 | leonardthesalmon@protonmail.com
60 |
61 | --------------------------------------------------------------------------------
62 |
63 | Step 0: Make sure that you have python3 installed. This varies system to system,
64 | but the python3 executable is usually in the `python3` command, although it's
65 | also sometimes in the default `python` command. Check with `python --version` or
66 | `python3 --version`
67 |
68 | *jiravim-python3-compile*
69 | Step 1: Make sure you compiled vim with `python3` support. This can be checked with >
70 | echo has('python3')
71 | If if returns 0, you might have to recompile vim with python3 support. This
72 | stackoverflow post seems like a pretty detailed explanation:
73 | https://stackoverflow.com/questions/30444890/vim-use-python3-interpreter-in-python-mode
74 |
75 | *jiravim-pip-install*
76 | Step 2: Install pip dependencies. Similarly to the situation in Step 0, the pip
77 | binary that install dependencies for python3 can be in either `pip` or `pip3`
78 | executables. Check by running it with the `--version` option to make sure it's
79 | compiled for python3. Then run `pip3 install --user -r requirements.txt` from
80 | the base directory of the project.
81 |
82 | If the plugin still doesn't see the python dependencies, you might want to try
83 | the following. Say your command for the pip associated with python3 is `pip3`.
84 | If you run `pip3 show jira`, there will be a field that says >
85 | Location:
86 | Copy this path, and put the following either in your `.vimrc` or
87 | `plugin/credentials.vim`: >
88 | python3 import sys
89 | python3 sys.path.append("")
90 | Do this for any package that the plugin complains about. This is a manual
91 | override that might solve your dependency problems.
92 |
93 | *jiravim-credentials*
94 | Step 3: Obtain your credentials. Let the following variables either in your
95 | `.vimrc` or in the `plugin/credentials.vim` file. For example, the following
96 | configuration >
97 | let g:jiraVimDomainName = "https://jira.antarctica.org"
98 | let g:jiraVimEmail = "joethepenguin@antarctica.org"
99 | let g:jiraVimToken = "1234567890abc..."
100 | would correspond to a user whose email is "joethepenguin@antarctica.org" and the
101 | website of his jira instance is "https://jira.antarctica.org". Alternatively,
102 | if you jira instance URL is of the form ".atlassian.net", you can
103 | just put "
105 | let g:jiraVimDomainName = "ocean" as your
106 | config. The Token is generated by atlassian, and here is a link describing how
107 | to get one: https://confluence.atlassian.com/cloud/api-tokens-938839638.html
108 |
109 | That should be it!
110 |
111 | *jiravim-tabular-install*
112 | [If the normal plugin doens't include this or you have problems importing the
113 | tabular submodule]
114 | Install Tabular with git submodules: Put these commands in the home directory
115 | in the terminal: >
116 | git submodule init tabular
117 | git submodule update
118 | This should install the tabular submodule and it will be imported
119 | automatically by the plugin. If that doesn't work either ...
120 |
121 | Install Tabular: Use your favorite plugin manager to install the Tabular plugin
122 | located at https://github.com/godlygeek/tabular. For Vim-Plug, put >
123 | Plug 'godlygeek/tabular'
124 | into your `.vimrc`
125 |
126 | ================================================================================
127 | COMMANDS *jiravim-commands*
128 |
129 | Here is the list of commands that are available to the user:
130 |
131 | --------------------------------------------------------------------------------
132 | *jiravim-boardopen* *:JiraVimBoardOpen*
133 | :JiraVimBoardOpen {name}
134 | Opens board {name} in a new split. Split occurs with the help of
135 | the `sbuffer` command, so it obeys any directives you set in your vimrc.
136 |
137 | *jiravim-boardopennosp* *:JiraVimBoardOpenNosp*
138 | :JiraVimBoardOpenNosp {name}
139 | Opens board {name} in the current window. Will give an error if
140 | current buffer has unsaved changes.
141 |
142 | *jiravim-issueopen* *:JiraVimIssueOpen*
143 | :JiraVimIssueOpen {name}
144 | Opens issue {name} in the current window. Will give an error if current
145 | buffer has unsaved changes.
146 |
147 | If you are planning to switch between your board view and your issue views
148 | frequently, it's recommended to use |JiraVimSelectIssueNosp| or
149 | |JiraVimSelectIssueSp| functions.
150 |
151 | *jiravim-issueopensp* *:JiraVimIssueOpenSp*
152 | :JiraVimIssueOpenSp {name}
153 | Opens issue {name} in a new split. Split occurs with the help of the
154 | `sbuffer` command, so it obeys any directives you set in your vimrc.
155 |
156 | Read |JiraVimIssueOpen| for recommendations on the usage of these two
157 | functions.
158 |
159 | *jiravim-selectissue* *:JiraVimSelectIssue*
160 | :JiraVimSelectIssue {command}
161 | Reads the issue key from the current line and uses {command} to open that
162 | issue. It sets a pointer to the original board buffer so that you can return
163 | to it with the |JiraVimReturn| commands.
164 |
165 | The {command} can be any command that accepts an string argument. This
166 | function only inputs the issue key from the current line. The standard
167 | commands to use are |JiraVimIssueOpen| and |JiraVimIssueOpenSp| with
168 | convenience commands |JiraVimSelectIssueSp| and |JiraVimSelectIssueNosp|
169 | respectively.
170 |
171 | This command is recommended over |JiraVimIssueOpen| when browsing from a
172 | board view because of its integration with |JiraVimReturn|. It's also
173 | recommended to set a keybind for this command in the appropriate filetypes
174 | (see |jiravim-filetypes|).
175 |
176 | *jiravim-selectissue-nosp* *:JiraVimSelectIssueNosp*
177 | :JiraVimSelectIssueNosp
178 | Convenience command for calling >
179 | :JiraVimSelectIssue JiraVimIssueOpen
180 | < See |JiraVimSelectIssue| for more information.
181 |
182 | *jiravim-selectissuesp* *:JiraVimSelectIssuesp*
183 | :JiraVimSelectIssueSp
184 | Convenience command for calling >
185 | :JiraVimSelectIssue JiraVimIssueOpenSp
186 | < See |JiraVimSelectIssue| for more information.
187 |
188 | *jiravim-return* *:JiraVimReturn*
189 | :JiraVimReturn
190 | Returns to the board from which the issue was opened. If the board buffer is
191 | opened in an active window, moves the cursor to that window. Otherwise,
192 | opens the board in the current window provided there are no unwritten
193 | changes.
194 |
195 | It uses the `b:boardBufferNumber` to orchestrate the return. Therefore you
196 | can use this function wherever as long as the variable is set, although it's
197 | only been tested when returning to a board view from an issue view. Designed
198 | to complement |JiraVimSelectIssue|.
199 |
200 | *jiravim-loadmore* *:JiraVimLoadMore*
201 | :JiraVimLoadMore
202 | Loads more issues from a certain column. When browsing a board, columns that
203 | have more than 10 issues will have a `---MORE---` line at the bottom. When
204 | calling this function over that line, it will load at most 10 more issues
205 | from the board.
206 |
207 | It's recommended to set a keybind for this command in the appropriate
208 | filetypes (see |jiravim-filetypes|).
209 |
210 | *jiravim-sprintopen* *:JiraVimSprintOpen*
211 | :JiraVimSprintOpen {name}
212 | Opens sprint {name} in the current window. Will give an error if current
213 | buffer has unsaved changes.
214 |
215 | This function was intended to use with the Scrum board view.
216 |
217 | *jiravim-selectsprint* *:JiraVimSelectSprint*
218 | :JiraVimSelectSprint
219 | Opens the sprint name from the current line. A convenience method that takes
220 | the name of the sprint on the current line and calls |JiraVimSprintOpen|
221 | with it.
222 |
223 | This function was intended to use with the Scrum board view. It's
224 | recommended to set a keybind for this command in the appropriate filetypes
225 | (see |jiravim-filetypes|).
226 |
227 | *jiravim-search* *JiraVimSearch*
228 | :JiraVimSearch {query}
229 | Performs a search on issues with the JQL {query} and returns paginated
230 | results. Use |JiraVimLoadMore| to load more issues.
231 |
232 | This function can be used as is, or you can use convenience functions,
233 | like |JiraVimSearchAssigned| and |JiraVimSearchPriorityUnassigned|. You
234 | can also create your own functions, and submit them to the project :^)
235 |
236 | *jiravim-search-assigned* *JiraVimSearchAssigned*
237 | :JiraVimSearchAssigned
238 | This is a convenience function for |JiraVimSearch| that gets all issues
239 | from all projects that are currently assigned to the user. Later issues
240 | get ranked first.
241 |
242 | *jiravim-search-priorityunassigned* *JiraVimSearchPriorityUnassigned*
243 | :JiraVimSearchPriorityUnassigned {priority}
244 | This is a convenience function for |JiraVimSearch| that gets all issues
245 | that are unassigned and with a priority higher than {priority}. Higher
246 | prioirty issues get ranked first.
247 |
248 | ================================================================================
249 | FILETYPES *jiravim-filetypes*
250 |
251 | *jiraboardview* *jiravim-boardview*
252 | jiraboardview
253 | This filetype is a generic filetype for Jira board views. It sets syntax
254 | options common to all boards, and each of the other board syntax files
255 | source it.
256 |
257 | *jirakanbanboardview* *jiravim-kanbanboardview*
258 | jirakanbanboardview
259 | This filetype is for kanban board views. Sources the syntax files from
260 | |jiraboarview|.
261 |
262 | Some useful commands for this filetype include |JiraVimSelectIssueSp|,
263 | |JiraVimSelectIssueNosp|, and |JiraVimLoadMore|. It's recommended that you
264 | make keybindings for these commands, see |jiravim-filetypes-keybinds|.
265 |
266 | *jirascrumboardview* *jiravim-scrumboardview*
267 | jirascrumboardview
268 | This filetype displays a list of 50 sprints from the scrum board in
269 | no particular order. Sources the syntax files from |jiraboarview|.
270 |
271 | Some useful commands for this filetype include |JiraVimSelectSprint|. It's
272 | recommended that you make keybindings for these commands, see
273 | |jiravim-filetypes-keybinds|.
274 |
275 | *jiraissueview* *jiravim-issueview*
276 | jiraissueview
277 | This filetype displays the issue information about a particular issue.
278 |
279 | Some useful commands for this filetype include |JiraVimReturn|. It's
280 | recommended that you make keybindings for these commands, see
281 | |jiravim-filetypes-keybinds|.
282 |
283 | *jirasprintview* *jiravim-sprintview*
284 | jirasprintview
285 | This filetype displays the issues in columns from a particular sprint.
286 |
287 | Some useful commands for this filetype include |JiraVimLoadMore|. It's
288 | recommended that you make keybindings for these commands, see
289 | |jiravim-filetypes-keybinds|.
290 |
291 | --------------------------------------------------------------------------------
292 | Keybind Advice *jiravim-filetypes-keybinds*
293 |
294 | It's recommended to put your keybinds into an |augroup| and assign them to
295 | filetypes with |autocmd|. So for example, a sample configuration would be: >
296 | augroup! jiravim_keybinds
297 | autocmd!
298 | autocmd FileType jirakanbanboardview nnoremap si \
299 | JiraVimSelectIssueSp
300 | autocmd FileType jirakanbanboardview, jirasprintview nnoremap \
301 | lm JiraVimLoadMore
302 | augroup END
303 |
304 | ncc :execute "normal! V/" b:commentPattern
8 |
--------------------------------------------------------------------------------
/ftplugin/jirakanbanboardview.vim:
--------------------------------------------------------------------------------
1 | execute "source " . expand(":h:p") . "/jiraboardview.vim"
2 |
--------------------------------------------------------------------------------
/ftplugin/jirascrumboardview.vim:
--------------------------------------------------------------------------------
1 | execute "source " . expand(":h:p") . "/jiraboardview.vim"
2 |
--------------------------------------------------------------------------------
/ftplugin/jirasearchview.vim:
--------------------------------------------------------------------------------
1 |
2 | set buftype=nofile
3 | set hidden
4 | normal! gg
5 |
--------------------------------------------------------------------------------
/ftplugin/jirasprintview.vim:
--------------------------------------------------------------------------------
1 | execute "source " . expand(":h:p") . "/jiraboardview.vim"
2 |
--------------------------------------------------------------------------------
/plugin/boardopen.vim:
--------------------------------------------------------------------------------
1 |
2 | function! JiraVimBoardOpen(name)
3 | let l:name = JiraVimTrimHelper(a:name)
4 | echo "Loading board " . l:name
5 | call check#CheckStorageSession()
6 |
7 | execute "python3 sys.argv = [\"" . l:name . "\"]"
8 | execute "python3 python.boards.open.JiraVimBoardOpen(sessionStorage)"
9 | endfunction
10 |
11 | function! JiraVimBoardOpenNoSp(name)
12 | let l:name = JiraVimTrimHelper(a:name)
13 | echo "Loading board " . l:name
14 | call check#CheckStorageSession()
15 |
16 | execute "python3 sys.argv = [\"" . l:name . "\"]"
17 | execute "python3 python.boards.open.JiraVimBoardOpen(sessionStorage, False)"
18 | endfunction
19 |
20 | command! -nargs=1 JiraVimBoardOpen call JiraVimBoardOpen()
21 | command! -nargs=1 JiraVimBoardOpenNosp call JiraVimBoardOpenNoSp()
22 |
--------------------------------------------------------------------------------
/plugin/issueopen.vim:
--------------------------------------------------------------------------------
1 |
2 | function! JiraVimIssueOpen(name)
3 | let l:name = JiraVimTrimHelper(a:name)
4 | echom "Loading issue " . l:name
5 | call check#CheckStorageSession()
6 |
7 | execute "python3 sys.argv = [\"" . l:name . "\"]"
8 | execute "python3 python.issues.open.JiraVimIssueOpen(sessionStorage)"
9 | endfunction
10 |
11 | function! JiraVimIssueOpenSp(name)
12 | let l:name = JiraVimTrimHelper(a:name)
13 | echom "Loading issue " . l:name
14 | call check#CheckStorageSession()
15 |
16 | execute "python3 sys.argv = [\"" . l:name . "\"]"
17 | execute "python3 python.issues.open.JiraVimIssueOpen(sessionStorage, True)"
18 | endfunction
19 |
20 | command -nargs=1 JiraVimIssueOpen call JiraVimIssueOpen()
21 | command -nargs=1 JiraVimIssueOpenSp call JiraVimIssueOpenSp()
22 |
--------------------------------------------------------------------------------
/plugin/loadmore.vim:
--------------------------------------------------------------------------------
1 |
2 | function! JiraVimLoadMore()
3 | call check#CheckStorageSession()
4 |
5 | let l:moreline = line(".")
6 |
7 | silent execute 'normal! ?\v^-+$' . "\"
8 | normal! k
9 | let l:categoryName = matchstr(getline("."), '\v^(\u+\s?)+')
10 | let l:first_issue_line = line(".") + 2
11 |
12 | " Move the cursor back to the more line
13 | execute ":" . l:moreline
14 |
15 | execute "python3 sys.argv = [\"" . l:categoryName . "\", " . l:moreline . "]"
16 | if &filetype ==# "jirasprintview"
17 | execute "python3 python.sprints.more.JiraVimLoadMore(sessionStorage)"
18 | elseif &filetype ==# "jiraboardview" || &filetype ==# "jirakanbanboardview"
19 | execute "python3 python.boards.more.JiraVimLoadMore(sessionStorage)"
20 | elseif &filetype ==# "jirasearchview"
21 | execute "python3 python.search.more.JiraVimLoadMore(sessionStorage)"
22 | else
23 | throw "Not a valid target for loading more issues"
24 | endif
25 | endfunction
26 |
27 | command JiraVimLoadMore call JiraVimLoadMore()
28 |
--------------------------------------------------------------------------------
/plugin/returntoboard.vim:
--------------------------------------------------------------------------------
1 |
2 | function! JiraVimReturn()
3 | """
4 | " This Function is designed to switch to the window with the board buffer
5 | " loaded. If no window like that exists, it loads the buffer in the
6 | " current window.
7 | """
8 | set modifiable
9 | if exists("b:boardBufferNumber") && b:boardBufferNumber !=? ""
10 | let l:bufferWindow = bufwinnr(b:boardBufferNumber)
11 | if l:bufferWindow !=? -1
12 | execute l:bufferWindow "wincmd w"
13 | else
14 | execute "buffer " . b:boardBufferNumber
15 | endif
16 | else
17 | throw "Could not identify the return board buffer. Are you sure you are supposed to be calling this?"
18 | endif
19 | endfunction
20 |
21 | command! JiraVimReturn call JiraVimReturn()
22 |
23 |
--------------------------------------------------------------------------------
/plugin/searchopen.vim:
--------------------------------------------------------------------------------
1 |
2 | function! JiraVimSearch(query)
3 | let l:query = JiraVimTrimHelper(a:query)
4 | echom "Searching the query ..."
5 | call check#CheckStorageSession()
6 |
7 | execute "python3 sys.argv = [\"" . l:query . "\"]"
8 | execute "python3 python.search.open.JiraVimSearchOpen(sessionStorage)"
9 | endfunction
10 |
11 | command -nargs=1 JiraVimSearchOpen call JiraVimSearch()
12 |
13 | command JiraVimSearchAssigned call JiraVimSearch("assignee=currentUser()")
14 | command -nargs=1 JiraVimSearchPriorityUnassigned call JiraVimSearch("assignee is empty and priority >= " . . " order by priority desc")
15 |
--------------------------------------------------------------------------------
/plugin/selectissue.vim:
--------------------------------------------------------------------------------
1 | function! JiraVimSelectIssue(command)
2 | let l:command = JiraVimTrimHelper(a:command)
3 | call check#CheckStorageSession()
4 | if -1 !=# matchstr(&filetype, g:jiraBoardFiletypePattern)
5 | let l:bufferNumber = bufnr("%")
6 | let l:line = getline(line("."))
7 | let l:issueMatch = JiraVimTrimHelper(matchstr(l:line, '\v\u+-\d+\s'))
8 | if l:issueMatch != ""
9 | execute l:command " " l:issueMatch
10 | let b:boardBufferNumber = l:bufferNumber
11 | endif
12 | else
13 | throw "The current buffer is not a board, are you sure you should be calling this command?"
14 | endif
15 | endfunction
16 |
17 | command -nargs=1 -complete=command JiraVimSelectIssue call JiraVimSelectIssue()
18 |
19 | " Convenience commands for split and nosplit
20 | command JiraVimSelectIssueNosp call JiraVimSelectIssue("JiraVimIssueOpen")
21 | command JiraVimSelectIssueSp call JiraVimSelectIssue("JiraVimIssueOpenSp")
22 |
--------------------------------------------------------------------------------
/plugin/selectsprint.vim:
--------------------------------------------------------------------------------
1 |
2 | function! JiraVimSelectSprint()
3 | let l:sprintName = JiraVimTrimHelper(getline(line(".")))
4 | execute "JiraVimSprintOpen " l:sprintName
5 | endfunction
6 |
7 | command JiraVimSelectSprint call JiraVimSelectSprint()
8 |
--------------------------------------------------------------------------------
/plugin/setup.vim:
--------------------------------------------------------------------------------
1 |
2 | let s:script_dir = expand(":p:h") . "/"
3 |
4 | " Make sure that all the necessary parts are in place {{{
5 | if !has('python3')
6 | throw "No python3 function found. Read the jiravim-python3-compile help section for more information."
7 | endif
8 |
9 | execute "python3 import sys"
10 | execute "python3 sys.path.append('" . s:script_dir . "../')"
11 |
12 | " Check that all pip dependencies are installed
13 | python3 import python.util.pip_check
14 | if py3eval("python.util.pip_check.check()")
15 | " throw "Please consult the 'jiravim-pip-install' help tag for help on installing pip dependencies."
16 | finish
17 | endif
18 |
19 | " Install Tabular submodule
20 | silent let s:gitOutput = system("git")
21 | if !matchstr(s:gitOutput, '\vgit:\ command\ not\ found')
22 | silent call system("git submodule init " . s:script_dir . "../tabular")
23 | silent call system("git submodule update " . s:script_dir . "../tabular")
24 | endif
25 |
26 | " Check that Tabularize command from Tabular is available
27 | if !exists(":Tabularize")
28 | " The dot between script_dir and the rest of the path is avoid a space in
29 | " the path definition
30 | execute "source" s:script_dir . "../tabular/plugin/Tabular.vim"
31 | execute "source" s:script_dir . "../tabular/autoload/tabular.vim"
32 | execute "source" s:script_dir . "../tabular/after/plugin/TabularMaps.vim"
33 |
34 | if !exists(":Tabularize")
35 | throw "Couldn't install Tabularize for some reason. Please contact the owner of this project for assistance"
36 | endif
37 | endif
38 |
39 |
40 | " }}}
41 |
42 | " Globally used python and vim functions/scripts {{{
43 |
44 | " Import all scripts with functions here
45 | python3 import jira
46 | python3 import python.boards.open
47 | python3 import python.boards.more
48 | python3 import python.issues.open
49 | python3 import python.search.open
50 | python3 import python.search.more
51 | python3 import python.sprints.open
52 | python3 import python.sprints.more
53 |
54 | " Set some global constants
55 | let g:jiraBoardFiletypePattern = '\vjira\a*boardview'
56 |
57 | " Some Plug-in specific Helper functions
58 | function! JiraVimTrimHelper(string)
59 | let l:arg = substitute(a:string, '\v^\s+', "", "")
60 | let l:arg = substitute(l:arg, '\v\s+$', "", "")
61 | return l:arg
62 | endfunction
63 |
64 | "}}}
65 |
--------------------------------------------------------------------------------
/plugin/sprintopen.vim:
--------------------------------------------------------------------------------
1 |
2 | function! JiraVimSprintOpen(name)
3 | let l:name = JiraVimTrimHelper(a:name)
4 | echo "Loading sprint " . l:name
5 | call check#CheckStorageSession()
6 |
7 | execute "python3 sys.argv = [\"" . l:name . "\"]"
8 | execute "python3 python.sprints.open.JiraVimSprintOpen(sessionStorage, False)"
9 | endfunction
10 |
11 | command! -nargs=1 JiraVimSprintOpen call JiraVimSprintOpen()
12 |
--------------------------------------------------------------------------------
/python/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/paulkass/jira-vim/3465d7b8f7f3b08abaed06c6e184ad50ed3f0935/python/__init__.py
--------------------------------------------------------------------------------
/python/boards/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/paulkass/jira-vim/3465d7b8f7f3b08abaed06c6e184ad50ed3f0935/python/boards/__init__.py
--------------------------------------------------------------------------------
/python/boards/more.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import vim
3 |
4 | from ..util.drawUtil import DrawUtil
5 |
6 | def JiraVimLoadMore(sessionStorage):
7 | category_name = sys.argv[0]
8 |
9 | more_line = int(sys.argv[1])
10 | buf = vim.current.buffer
11 | vim.command("set modifiable")
12 |
13 | # Delete the MORE line and the space below: that will be handled by DrawUtil
14 | del buf[more_line-1]
15 | del buf[more_line-1]
16 |
17 | board = sessionStorage.getBoard(buf.number)
18 |
19 | for c in board.columns:
20 | if c.upper() == category_name:
21 | category_name = c
22 | break
23 |
24 | line = more_line
25 | DrawUtil.draw_items(buf, board, sessionStorage, line=line, itemExtractor=lambda o: o.getIssues(column=category_name), withCategoryHeaders=False)
26 | vim.command("set nomodifiable")
27 |
--------------------------------------------------------------------------------
/python/boards/open.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import vim
3 | from ..util.drawUtil import DrawUtil
4 |
5 | # arguments expected in sys.argv
6 | def JiraVimBoardOpen(sessionStorage, isSplit=True):
7 | boardName = str(sys.argv[0])
8 |
9 | # Buff Setup Commands
10 | buf, new = sessionStorage.getBuff(objName=boardName)
11 | if isSplit:
12 | vim.command("sbuffer "+str(buf.number))
13 | else:
14 | vim.command("buffer "+str(buf.number))
15 | vim.command("set modifiable")
16 | if new:
17 | board = sessionStorage.getBoard(buf.number, boardName=boardName)
18 | DrawUtil.draw_header(buf, board, boardName)
19 | DrawUtil.draw_items(buf, board, sessionStorage)
20 | DrawUtil.set_filetype(board)
21 | vim.command("set nomodifiable")
22 |
--------------------------------------------------------------------------------
/python/common/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/paulkass/jira-vim/3465d7b8f7f3b08abaed06c6e184ad50ed3f0935/python/common/__init__.py
--------------------------------------------------------------------------------
/python/common/board.py:
--------------------------------------------------------------------------------
1 |
2 | import urllib
3 |
4 | from ..util.itemExtractor import ObjectItemExtractor
5 |
6 | class Board:
7 | def __init__(self, boardId, boardName, connection):
8 | self.connection = connection
9 | self.id = boardId
10 | self.boardName = boardName
11 | self.baseUrl = "/rest/agile/1.0/board/"+urllib.parse.quote(boardId)
12 | self.requiredProperties = ["key", "status", "summary"]
13 |
14 | self.boardConf = self.connection.customRequest(self.baseUrl+"/configuration").json()
15 | self.statusToColumn = {}
16 | self.columns = list()
17 |
18 | """
19 | The idea here is that each column can display many statuses. So the relationship from status to column is many to one. Then each instance sorts issues into columns on its own.
20 | """
21 | col_set = set()
22 | for col in self.boardConf["columnConfig"]["columns"]:
23 | cName = col["name"]
24 | if cName not in col_set:
25 | self.columns.append(cName)
26 | col_set.add(cName)
27 | for s in col["statuses"]:
28 | self.statusToColumn[s["id"]] = cName
29 |
30 | def all_issues_provider(startAt, maxResults):
31 | vals = (','.join(self.requiredProperties), startAt, maxResults)
32 | response = self.connection.customRequest(self.baseUrl+"/issue?fields=%s&startAt=%d&maxResults=%d" % vals).json()
33 | return response["issues"]
34 |
35 | self.issueExtractor = ObjectItemExtractor(all_issues_provider)
36 |
37 | def getIssues(self):
38 | """
39 | Creates an category for all issues.
40 |
41 | Uses the built in issueExtractor object to extract all issues into a single "All Issues" category and return them.
42 |
43 | Parameters
44 | ----------
45 | None
46 |
47 | Returns
48 | -------
49 | List
50 | A list with a single tuple of the format ("All Issues", , [list of (issue key, issue summary) tuples]).
51 |
52 | """
53 |
54 | r = self.issueExtractor.__next__()
55 | return [("All Issues", self.issueExtractor.finished, [(i["key"], "") for i in r])]
56 |
--------------------------------------------------------------------------------
/python/common/connection.py:
--------------------------------------------------------------------------------
1 |
2 | import re
3 | import requests
4 |
5 | from jira import JIRA
6 | from .board import Board
7 | from .kanbanBoard import KanbanBoard
8 | from .scrumBoard import ScrumBoard
9 | from .issue import Issue
10 |
11 | class Connection:
12 | def __init__(self, name, email, token):
13 | self.__constructUrl(name)
14 | self.__email = email
15 | self.__token = token
16 | self.__jira = JIRA(options={"server": self.__baseUrl}, basic_auth=(self.__email, self.__token))
17 | self.__buildBoardHash()
18 |
19 | def __constructUrl(self, site):
20 | """
21 | Constructs a base url from user input.
22 |
23 | This function is designed to take the user input and self-assign the __baseUrl variable with the base URL for any further requests. It supports naming the jira instance (so if you have a jira instance of antarctica.atlassian.net, you could input "atlassian") as well as full websites.
24 |
25 | Parameters
26 | ----------
27 | site : String
28 | A string that represents the connection host. It could either be a name (as explained above, "antarctica" is a valid site input for "antartica.atlassian.net") or a full website.
29 |
30 | Returns
31 | -------
32 | Nothing
33 |
34 | """
35 |
36 | # Pattern experiments at: https://pythex.org/?regex=%5CA(http(s)%3F%3A%2F%2F)%3F%5B%5Cw%5C%24%5C-%5C_%5C.%5C%2B%5C!%5C*%5C%27%5C(%5C)%5C%2C%5D%2B%5C.%5Cw%7B2%2C3%7D%5CZ&test_string=https%3A%2F%2Fhello.com&ignorecase=0&multiline=0&dotall=0&verbose=0
37 | # We could use urllib if the need arises
38 | website_pattern = "\A(http(s)?://)?[\w\$\-\_\.\+\!\*\'\(\)\,]+\.\w{2,3}\Z"
39 | if re.search(website_pattern, site):
40 | self.__baseUrl = site
41 | else:
42 | self.__baseUrl = "https://"+site+".atlassian.net"
43 |
44 | def __buildBoardHash(self):
45 | """
46 | Builds a board configuration lookup table.
47 |
48 | Builds a board hash that matches the name of the board to the configuration for that board.
49 |
50 | Parameters
51 | ----------
52 | None
53 |
54 | Returns
55 | -------
56 | None
57 |
58 | """
59 |
60 | board_hash = {}
61 | boardList = []
62 | lastPage = False
63 | initReq = "/rest/agile/1.0/board"
64 | reqStr = initReq
65 | while not lastPage:
66 | rawBoardList = self.customRequest(reqStr).json()
67 | # concat the existing lists with the new one
68 | boardList = boardList + rawBoardList["values"]
69 | # update last page with api resp
70 | lastPage = rawBoardList["isLast"]
71 | # keep requesting boards until all are returned
72 | reqStr = "%s?startAt=%s" % (initReq, str(rawBoardList["startAt"] + rawBoardList["maxResults"]))
73 | for v in boardList:
74 | # The board name in v comes as " board"
75 | matches = re.match(r"\A([\s\w]+)\s[Bb]oard\Z", v["name"])
76 | if matches is None:
77 | bName = v["name"]
78 | else:
79 | bName = matches.group(1)
80 | board_hash[bName] = v
81 | self.__board_conf_hash = board_hash
82 |
83 | def getBaseUrl(self):
84 | """
85 | Getter for the base url
86 | """
87 | return self.__baseUrl
88 |
89 | def getJiraObject(self):
90 | """
91 | Getter for the jira object used to access information about issues.
92 | """
93 | return self.__jira
94 |
95 | def getBoard(self, board_name):
96 | """
97 | Returns a new board object.
98 |
99 | Looks up the board_name configuration and produces a board object of the correct subclass (KanbanBoard, ScrumBoard).
100 |
101 | Parameters
102 | ----------
103 | board_name : String
104 | Name of the board to create an object for.
105 |
106 | Returns
107 | -------
108 | Board
109 | Board object that corresponds to the board_name
110 |
111 | """
112 |
113 | if board_name in self.__board_conf_hash:
114 | boardType = self.__board_conf_hash[board_name]["type"]
115 | boardId = str(self.__board_conf_hash[board_name]["id"])
116 | if boardType == "kanban":
117 | return KanbanBoard(boardId, board_name, self)
118 | if boardType == "scrum":
119 | return ScrumBoard(boardId, board_name, self)
120 | return Board(boardId, board_name, self)
121 | return None
122 |
123 | def getIssue(self, issue_key):
124 | """
125 | Create a new Issue object
126 |
127 | Creates a new issue object from issue_key
128 |
129 | Parameters
130 | ----------
131 | issue_key : String
132 | Issue key for that the issue
133 |
134 | Returns
135 | -------
136 | Issue
137 | Issue object
138 |
139 | """
140 |
141 | return Issue(issue_key, self)
142 |
143 | def customRequest(self, request):
144 | """
145 | Make custom request through the connection to jira.
146 |
147 | This function is useful when the provided jira object cannot easily return the data you need. Then you can specify a custom request that will be sent to the appropriate jira domain, and the resutls returned to you.
148 |
149 | Parameters
150 | ----------
151 | request : String
152 | Path of the request to make
153 |
154 | Returns
155 | -------
156 | Response
157 | This is a requests.Response object that contains the response from Jira.
158 |
159 | """
160 |
161 | reqStr = self.__baseUrl + request
162 | return requests.get(reqStr, auth=(self.__email, self.__token))
163 |
--------------------------------------------------------------------------------
/python/common/issue.py:
--------------------------------------------------------------------------------
1 |
2 | from jira.resources import Issue as JiraIssue
3 |
4 | class Issue:
5 | def __init__(self, issueKey, connection):
6 | self.connection = connection
7 | jira = self.connection.getJiraObject()
8 |
9 | if isinstance(issueKey, JiraIssue):
10 | self.obj = issueKey
11 | self.issueKey = self.obj.key
12 | else:
13 | self.obj = jira.issue(issueKey)
14 | self.issueKey = issueKey
15 | self.fields = self.obj.fields
16 | self.issueId = self.obj.id
17 |
18 | # These fields will be displayed in normal category style on issue views
19 | self.displayFields = ["summary", "description"]
20 |
21 | # These fields will be displayed in the Basic Information section
22 | self.basicInfo = ["status", "reporter", "assignee"]
23 |
24 | def getField(self, field, as_str=True):
25 | """
26 | Returns the value of the field.
27 |
28 | Returns the value of the field belonging to this particular issue.
29 |
30 | Parameters
31 | ----------
32 | field : String
33 | A string that specifies the desired field
34 | as_str : Boolean (Optional)
35 | Specifies whether to return the property in string format. Defaults to True
36 |
37 | Returns
38 | -------
39 | Object (usually String)
40 | String that represents value of the field of this particular issue.
41 |
42 | """
43 | obj = self.fields.__dict__.get(field)
44 | return str(obj) if as_str else obj
45 |
46 | def getComments(self):
47 | """
48 | Returns a list of columns.
49 |
50 | Returns a list of column objects that contain information about the columns.
51 |
52 | Parameters
53 | ----------
54 | None
55 |
56 | Returns
57 | -------
58 | Nothing
59 |
60 | """
61 |
62 | comment_obj = self.getField("comment", as_str=False)
63 | return comment_obj.comments
64 |
65 |
--------------------------------------------------------------------------------
/python/common/kanbanBoard.py:
--------------------------------------------------------------------------------
1 | from .board import Board
2 | from ..util.itemCategorizer import ItemCategorizer
3 | from ..util.itemExtractor import ObjectItemExtractor
4 |
5 | class KanbanBoard(Board):
6 | def __init__(self, boardId, boardName, connection):
7 | Board.__init__(self, boardId, boardName, connection)
8 | self.columnExtractors = {}
9 |
10 | for col in self.columns:
11 | self.columnExtractors[col] = ObjectItemExtractor.create_column_issue_extractor(self, col)
12 |
13 | def getIssues(self, column=None):
14 | """
15 | Get a batch of issues from board.
16 |
17 | Get a batch of issues from the board, either sorted by column. Returns at most 10 from the column specified. Otherwise, collects issues from all columns in batches and returns them, categorized.
18 |
19 | Parameters
20 | ----------
21 | column : String (Optional)
22 | Column from which to retrieve issues.
23 |
24 | Returns
25 | -------
26 | List
27 | Categorized list of (, , [issue keys]) tuples according to the issue categorizer from ItemCategorizer.
28 |
29 | """
30 |
31 | if column:
32 | columns = [column]
33 | else:
34 | columns = self.columns
35 | returnIssues = []
36 | for c in columns:
37 | r = self.columnExtractors[c].__next__()
38 | returnIssues += ItemCategorizer.issueCategorizer(r, self.statusToColumn, self.columnExtractors)
39 | # Sort issues by Category
40 | return returnIssues
41 |
--------------------------------------------------------------------------------
/python/common/scrumBoard.py:
--------------------------------------------------------------------------------
1 | from .board import Board
2 | from .sprint import Sprint
3 |
4 | class ScrumBoard(Board):
5 | def __init__(self, boardId, boardName, connection):
6 | Board.__init__(self, boardId, boardName, connection)
7 |
8 | sprintConf = self.connection.customRequest(self.baseUrl+"/sprint").json()
9 |
10 | self.__sprintsById = {}
11 | self.__sprintsByName = {}
12 |
13 | for sprintObj in sprintConf["values"]:
14 | sprint = Sprint(sprintId=sprintObj["id"],
15 | url=sprintObj["self"],
16 | name=sprintObj["name"],
17 | board=self,
18 | connection=connection,
19 | state=sprintObj["state"],
20 | startDate=sprintObj["startDate"],
21 | endDate=sprintObj["endDate"])
22 | self.__sprintsById[int(sprintObj["id"])] = sprint
23 | self.__sprintsByName[sprintObj["name"]] = sprint
24 |
25 | def getSprints(self):
26 | """
27 | Returns list of sprints for this board.
28 |
29 | Returns the list of the Sprints in the standard format for extraction (see DrawUtil).
30 |
31 | Parameters
32 | ----------
33 | None
34 |
35 | Returns
36 | -------
37 | List
38 | Returns a list in the format of ["Sprints, False, [(, "")]]
39 |
40 | """
41 |
42 | # No pagination support for Sprints yet
43 | return [["Sprints", False, [(name, " ") for name in self.__sprintsByName]]]
44 |
45 | def getSprint(self, key):
46 | """
47 | Returns sprint object by either id or name.
48 |
49 | Parameters
50 | ----------
51 | key : Integer or String
52 | The key that is used to get the sprint, either an integer representing the id or a string representing the name
53 |
54 | Returns
55 | -------
56 | Sprint
57 | the sprint corresponding to the key
58 |
59 | """
60 |
61 | if key in self.__sprintsById:
62 | return self.__sprintsById[key]
63 | return self.__sprintsByName[key]
64 |
--------------------------------------------------------------------------------
/python/common/search.py:
--------------------------------------------------------------------------------
1 |
2 | from ..util.itemExtractor import ObjectItemExtractor
3 | from ..common.issue import Issue
4 |
5 | class Search:
6 | def __init__(self, query, connection, batch_size=10):
7 | self.connection = connection
8 | self.itemExtractor = ObjectItemExtractor.create_search_extractor(self.connection, query, batch_size=batch_size)
9 |
10 | def getIssues(self):
11 | """
12 | Get the next batch of issues.
13 |
14 | Returns a batch of issues.
15 |
16 | Parameters
17 | ----------
18 | None
19 |
20 | Returns
21 | -------
22 | A standard list of issues categorized in one category.
23 | """
24 | # This could be made more efficient
25 | issues = [Issue(i.key, self.connection) for i in self.itemExtractor.__next__()]
26 | return [("Search results", not self.itemExtractor.finished, [(i.issueKey, i.getField("summary", as_str=True)) for i in issues])]
27 |
--------------------------------------------------------------------------------
/python/common/sessionObject.py:
--------------------------------------------------------------------------------
1 | import vim
2 | from .connection import Connection
3 |
4 | class SessionObject():
5 | def __init__(self):
6 | self.connection = SessionObject.getConnectionFromVars()
7 |
8 | # When retrieving buffers, we need to make sure that the buffer is valid.
9 | # If the buffer is cleared or wiped, it will be marked invalid and we can't retrieve it again.
10 | self.__bufferHash = {}
11 | self.__namesToIds = {}
12 |
13 | # Also cache board objects: this one maps buffer numbers to Board and Sprint objects
14 | self.__boardsHash = {}
15 | self.__sprintsHash = {}
16 |
17 | self.__searchesHash = {}
18 |
19 | @staticmethod
20 | def getConnectionFromVars():
21 | """
22 | Create connection from vars.
23 |
24 | Creates a connection from the global configuration variables and returns it
25 |
26 | Parameters
27 | ----------
28 | None
29 |
30 | Returns
31 | -------
32 | Connection
33 | The connection object created from the global variables.
34 |
35 | """
36 |
37 | domainName = SessionObject.decodeString(vim.vars["jiraVimDomainName"])
38 | email = SessionObject.decodeString(vim.vars["jiraVimEmail"])
39 | token = SessionObject.decodeString(vim.vars["jiraVimToken"])
40 |
41 | return Connection(domainName, email, token)
42 |
43 | def assignBoard(self, board, buff):
44 | """
45 | Assigns associations between a board and a buffer to the caches.
46 |
47 | Parameters
48 | ----------
49 | board : Board
50 | Object to be associated with the buffer
51 | buff : Vim Buffer
52 | A vim buffer object to be associated with board
53 |
54 | Returns
55 | -------
56 | Nothing
57 |
58 | """
59 |
60 | self.__bufferHash[board.id] = buff
61 | self.__namesToIds[board.boardName] = board.id
62 | self.__boardsHash[buff.number] = board
63 |
64 | def assignSprint(self, sprint, buff):
65 | """
66 | Assigns a sprint to the session sprint cache. Note that it doesn't assign by sprint name.
67 | """
68 | self.__sprintsHash[buff.number] = sprint
69 |
70 | def assignSearch(self, search, buf):
71 | self.__bufferHash[search.query_id] = buf
72 | self.__searchesHash[buf.number] = search
73 |
74 | def assignIssue(self, issue, buff):
75 | self.__bufferHash[issue.issueId] = buff
76 | self.__namesToIds[issue.issueKey] = issue.issueId
77 |
78 | def getBufferByIndex(self, key):
79 | """
80 | Return buffer based on either item key or item name.
81 |
82 | Returns the buffer from the key or item name of the item you need the buffer for, and returns the buffer if the buffer is valid.
83 |
84 | Parameters
85 | ----------
86 | key : int or String
87 | Either the Id or the Name of the object
88 |
89 | Returns
90 | -------
91 | Buffer
92 | Buffer corresponding to the object
93 |
94 | """
95 |
96 | if key in self.__bufferHash:
97 | buff = self.__bufferHash[key]
98 | return buff if buff.valid else None
99 | if key in self.__namesToIds:
100 | buff = self.__bufferHash[self.__namesToIds[key]]
101 | return buff if buff.valid else None
102 | return None
103 |
104 | def getBoard(self, buf, boardName=None):
105 | """
106 | Retrieve board object based on buffer number
107 |
108 | This function takes in an identifier and tries to retrieve an object from the cache corresponding to the identifier (which can be a buffer id, a buffer, or a string of the board name). If it does not find a string object, it goes ahead and creates one by calling the getBoard method of the connection object. If it does not find a buffer number of buffer object in the cache, it creates one based on the jiraVimBoardName variable.
109 |
110 | This function only accounts for missing keys in the cache.
111 |
112 | Parameters
113 | ----------
114 | buf : Integer or Buffer
115 | Buffer object or integer representing the number of the buffer
116 | boardName : String
117 | Name of board to be created if board doesn't exist in cache
118 |
119 | Returns
120 | -------
121 | Board
122 | Board corresponding to the buffer that was queried
123 |
124 | """
125 | create_new_object = self.connection.getBoard
126 |
127 | if isinstance(buf, int):
128 | board = self.__boardsHash.get(buf, create_new_object(boardName))
129 | self.assignBoard(board, vim.buffers[buf])
130 | return board
131 | if buf in vim.buffers:
132 | board = self.__boardsHash.get(buf.number, create_new_object(boardName))
133 | self.assignBoard(board, buf)
134 | return board
135 | return None
136 |
137 | def getSprint(self, sprintIdentifier):
138 | """
139 | Similar to getBoard for boards: returns cached sprint if it could find it for this buffer or name.
140 |
141 | Note: doesn't work if you input
142 | """
143 | if sprintIdentifier in vim.buffers:
144 | sprint = self.__sprintsHash.get(sprintIdentifier.number, None)
145 | if sprint:
146 | self.assignSprint(sprint, sprintIdentifier)
147 | return sprint
148 | sprint = self.__sprintsHash.get(sprintIdentifier, None)
149 | if sprint and isinstance(sprintIdentifier, int):
150 | self.assignSprint(sprint, vim.buffers[sprintIdentifier])
151 | return sprint
152 |
153 | def getSearch(self, buf_number):
154 | return self.__searchesHash[buf_number]
155 |
156 | def getBuff(self, objId=None, objName=None, createNew=True):
157 | """
158 | Creates a buffer if none exists for a given object ID or Name
159 |
160 | Tries to return a buffer based on the objId and objName fields, and if there is none, creates a new buffer for the object.
161 |
162 | Parameters
163 | ----------
164 | objId : Integer (Optional)
165 | Id of object.
166 | objName : String (Optional)
167 | Name of object
168 | createNew : Boolean (Optional)
169 | Determines whether to create a new buffer if the buffer for the object is not found in the hashes. Defaults to True
170 |
171 | Returns
172 | -------
173 | Tuple
174 | Returns a tuple that contains the Buffer, and a boolean. The boolean is True is this a newly created buffer, created by this method.
175 |
176 | """
177 |
178 | if objId is not None:
179 | buff = self.getBufferByIndex(objId)
180 | if buff is not None:
181 | return (buff, False)
182 | if objName is not None:
183 | buff = self.getBufferByIndex(objName)
184 | if buff is not None:
185 | return (buff, False)
186 | # return new buffer
187 | if createNew:
188 | return (self.__createBuffer(), True)
189 | return (None, False)
190 |
191 | def __createBuffer(self):
192 | # Creates a new buffer, saves it, and then uses the hidden command to hide it
193 | vim.command("new")
194 | buf = vim.current.buffer
195 | vim.command("hide")
196 | return buf
197 |
198 | @staticmethod
199 | def decodeString(candidate):
200 | # Decodes the string in utf-8 only if in vim, neovim puts it in the default locale automatically
201 | if isinstance(candidate, str):
202 | return candidate
203 | else:
204 | return candidate.decode("utf-8")
205 |
206 |
--------------------------------------------------------------------------------
/python/common/sprint.py:
--------------------------------------------------------------------------------
1 | from ..util.itemCategorizer import ItemCategorizer
2 | from ..util.itemExtractor import ObjectItemExtractor
3 |
4 | class Sprint():
5 | def __init__(self, sprintId, url, board, connection, state=None, name=None, startDate=None, endDate=None):
6 | self.sprintId = sprintId
7 | self.__url = url
8 | self.board = board
9 | self.name = name
10 | self.__state = state
11 | self.__startDate = startDate
12 | self.__endDate = endDate
13 | self.baseUrl = "/rest/agile/1.0/board/"+str(board.id)+"/sprint/"+str(sprintId)
14 | self.connection = connection
15 | self.requiredProperties = ["key", "status", "summary"]
16 |
17 | self.columnExtractors = {}
18 | for col in self.board.columns:
19 | self.columnExtractors[col] = ObjectItemExtractor.create_column_issue_extractor(self.board, col)
20 |
21 | def getIssues(self, column=None):
22 | """
23 | Get issues for the sprint.
24 |
25 | Similar to the KanbanBoard issue extraction.
26 |
27 | Parameters
28 | ----------
29 | column : String (Optional)
30 | Column name of the column from which issues should be extracted.
31 |
32 | Returns
33 | -------
34 | List
35 | List in the standard extration formula of issues in a certain column in the sprint.
36 |
37 | """
38 |
39 | if column:
40 | columns = [column]
41 | else:
42 | columns = self.board.columns
43 | returnIssues = []
44 | for c in columns:
45 | r = self.columnExtractors[c].__next__()
46 | returnIssues += ItemCategorizer.issueCategorizer(r, self.board.statusToColumn, self.columnExtractors)
47 | return returnIssues
48 |
--------------------------------------------------------------------------------
/python/issues/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/paulkass/jira-vim/3465d7b8f7f3b08abaed06c6e184ad50ed3f0935/python/issues/__init__.py
--------------------------------------------------------------------------------
/python/issues/open.py:
--------------------------------------------------------------------------------
1 |
2 | import sys
3 | from datetime import datetime
4 | import vim
5 |
6 | from ..util.formatters import Formatters, FormatterFactory
7 | from ..common.issue import Issue
8 | from ..util.drawUtil import DrawUtil
9 |
10 | # Arguments are expected through sys.argv
11 | def JiraVimIssueOpen(sessionStorage, isSplit=False):
12 | issueKey = str(sys.argv[0])
13 | connection = sessionStorage.connection
14 | # Carry on the board name from the previous buffer
15 |
16 | buf, new = sessionStorage.getBuff(objName=issueKey)
17 | if isSplit:
18 | vim.command("sbuffer "+str(buf.number))
19 | else:
20 | vim.command("buffer "+str(buf.number))
21 | vim.command("set modifiable")
22 | if new:
23 | issue = Issue(issueKey, connection)
24 | project = str(issue.getField("project"))
25 | issue_type = str(issue.getField("issuetype"))
26 | DrawUtil.set_filetype(issue)
27 |
28 | sessionStorage.assignIssue(issue, buf)
29 |
30 | ##### DRAW THE HEADER
31 | line = DrawUtil.draw_header(buf, issue, "%s %s" % (issueKey, project)) + 2
32 | buf.append(issue_type, 2)
33 |
34 | ##### DRAW BASIC INFORMATION
35 | basic_info_category = ("Basic Information", [(field.title(), issue.getField(field)) for field in issue.basicInfo])
36 | line = DrawUtil.draw_category(buf, issue, basic_info_category, line=line, str_generator=': '.join) + 1
37 | buf.append("")
38 |
39 | ##### DRAW DISPLAY FIELDS
40 | categories = [(field.title(), [("", issue.getField(field))]) for field in issue.displayFields]
41 | for c in categories:
42 | line = DrawUtil.draw_category(buf, issue, c, line=line, formatter=Formatters.DISPLAY_FIELDS_FORMATTER, str_generator=''.join) + 1
43 | buf.append("")
44 |
45 | ##### DRAW COMMENTS
46 | comments = issue.getComments()
47 | comments = ("Comments", [(str(c.author) + "[" + (str(c.author.name) if hasattr(c.author, "name") else str(c.author.accountId)) + "] " + datetime.strptime(c.created, "%Y-%m-%dT%H:%M:%S.%f%z").strftime("%c"), c.body) for c in comments])
48 | # This is just a very long way of telling the computer to format each comment as :
49 | # The %c in strftime is to format the date in a human readable way
50 | comment_formatter = FormatterFactory.get_comment_formatter(len(comments[1]))
51 | line = DrawUtil.draw_category(buf, issue, comments, line=line, formatter=comment_formatter, str_generator=": ".join) + 1
52 | buf.append("")
53 |
54 | vim.command("set nomodifiable")
55 | vim.command("normal! gg")
56 |
--------------------------------------------------------------------------------
/python/search/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/paulkass/jira-vim/3465d7b8f7f3b08abaed06c6e184ad50ed3f0935/python/search/__init__.py
--------------------------------------------------------------------------------
/python/search/more.py:
--------------------------------------------------------------------------------
1 |
2 | import sys
3 | import vim
4 | from ..util.drawUtil import DrawUtil
5 |
6 | def JiraVimLoadMore(sessionStorage):
7 | _, more_line = tuple(sys.argv)
8 |
9 | buf = vim.current.buffer
10 | vim.command("set modifiable")
11 |
12 | del buf[more_line-1]
13 | del buf[more_line-1]
14 |
15 | search = sessionStorage.getSearch(buf.number)
16 |
17 | line = more_line
18 | DrawUtil.draw_items(buf, search, sessionStorage, line=line, withCategoryHeaders=False)
19 |
--------------------------------------------------------------------------------
/python/search/open.py:
--------------------------------------------------------------------------------
1 |
2 | import sys
3 | import uuid
4 | import vim
5 | from ..common.search import Search
6 | from ..util.drawUtil import DrawUtil
7 |
8 | def JiraVimSearchOpen(sessionStorage):
9 | query = str(sys.argv[0])
10 | connection = sessionStorage.connection
11 |
12 | sid = uuid.uuid4()
13 | buf, new = sessionStorage.getBuff(objId=sid)
14 | vim.command("sbuffer "+str(buf.number))
15 | vim.command("set modifiable")
16 | if new:
17 | search = Search(query, connection)
18 | search.query_id = sid
19 | sessionStorage.assignSearch(search, buf)
20 | line = 0
21 | line = DrawUtil.draw_header(buf, search, "Search for \""+query+"\"") + 1
22 | line = DrawUtil.draw_items(buf, search, sessionStorage, line=line)
23 | vim.command("set nomodifiable")
24 | DrawUtil.set_filetype(search)
25 |
--------------------------------------------------------------------------------
/python/sprints/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/paulkass/jira-vim/3465d7b8f7f3b08abaed06c6e184ad50ed3f0935/python/sprints/__init__.py
--------------------------------------------------------------------------------
/python/sprints/more.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import vim
3 |
4 | from ..util.drawUtil import DrawUtil
5 |
6 | def JiraVimLoadMore(sessionStorage):
7 | category_name = sys.argv[0]
8 |
9 | more_line = int(sys.argv[1])
10 | buf = vim.current.buffer
11 | vim.command("set modifiable")
12 |
13 | # Delete the MORE line and the space below: that will be handled by DrawUtil
14 | del buf[more_line-1]
15 | del buf[more_line-1]
16 |
17 | sprint = sessionStorage.getSprint(buf.number)
18 |
19 | for c in sprint.board.columns:
20 | if c.upper() == category_name:
21 | category_name = c
22 | break
23 |
24 | line = more_line
25 | DrawUtil.draw_items(buf, sprint, sessionStorage, line=line, itemExtractor=lambda o: o.getIssues(column=category_name), withCategoryHeaders=False)
26 | vim.command("set nomodifiable")
27 |
--------------------------------------------------------------------------------
/python/sprints/open.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import vim
3 | from ..util.drawUtil import DrawUtil
4 |
5 | def JiraVimSprintOpen(sessionStorage, isSplit=True):
6 | sprintName = str(sys.argv[0])
7 |
8 | boardBuffer = vim.current.buffer
9 |
10 | board = sessionStorage.getBoard(boardBuffer.number)
11 | buf, _ = sessionStorage.getBuff(objName=sprintName)
12 | if isSplit:
13 | vim.command("sbuffer "+str(buf.number))
14 | else:
15 | vim.command("buffer "+str(buf.number))
16 | vim.command("set modifiable")
17 |
18 | sprint = sessionStorage.getSprint(sprintName)
19 | if not sprint:
20 | sprint = board.getSprint(sprintName)
21 | sessionStorage.assignSprint(sprint, buf)
22 | DrawUtil.draw_header(buf, sprint, sprintName)
23 | DrawUtil.draw_items(buf, sprint, sessionStorage)
24 | DrawUtil.set_filetype(sprint)
25 | vim.command("set nomodifiable")
26 |
--------------------------------------------------------------------------------
/python/util/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/paulkass/jira-vim/3465d7b8f7f3b08abaed06c6e184ad50ed3f0935/python/util/__init__.py
--------------------------------------------------------------------------------
/python/util/drawUtil.py:
--------------------------------------------------------------------------------
1 | from collections import OrderedDict
2 | import vim
3 |
4 | from .formatters import Formatters
5 | from ..common.kanbanBoard import KanbanBoard
6 | from ..common.scrumBoard import ScrumBoard
7 | from ..common.board import Board
8 | from ..common.sprint import Sprint
9 | from ..common.issue import Issue
10 | from ..common.search import Search
11 |
12 |
13 | class DrawUtil():
14 |
15 | MAPPINGS = OrderedDict({
16 | "kanban": KanbanBoard,
17 | "scrum": ScrumBoard,
18 | "board": Board,
19 | "sprint": Sprint,
20 | "issue": Issue,
21 | "search": Search
22 | })
23 | RESERVED_KEYWORDS = ["default", "obj"]
24 |
25 | @staticmethod
26 | def __type_selector(**args):
27 | """
28 | This is a helper method to return a value based on the type of an object.
29 |
30 | Many cases here will depend on the type of the object that is being drawn onto a buffer. This means that we need to somehow create mappings to assign crucial parameters depending on the type of the object in question. This method uses an OrderedDict to check the type of the object from bottom to top (so if class A inherits from class B, class A will be checked before class B) and return an appropriate value.
31 |
32 | Parameters
33 | ----------
34 | **args: dict
35 | A dictionary object that may contain the following fields:
36 | kanban,
37 | scrum,
38 | board,
39 | sprint,
40 | issue,
41 | default,
42 | obj
43 |
44 | The obj mapping is required for the operation to work.
45 |
46 | Returns
47 | -------
48 | Some value
49 | This is the value obtained from the key in the **args dict that corresponds to the most granular class of the object passed in. If the object matches none of the types from **args, use value at key "default". If no default, returns None.
50 |
51 | """
52 |
53 | # Check to see that obj exists and throw an error if it doesn't
54 | obj = args["obj"]
55 |
56 | for k, c in DrawUtil.MAPPINGS.items():
57 | if k not in DrawUtil.RESERVED_KEYWORDS and k in args and isinstance(obj, c):
58 | return args[k]
59 |
60 | return args.get("default", None)
61 |
62 | @staticmethod
63 | def draw_header(buf, obj, name, formatting=None):
64 | """
65 | Draw the header for object.
66 |
67 | Parameters
68 | ----------
69 | buf : vim.buffer
70 | Buffer to be drawn onto
71 | obj : Object
72 | The object to examine
73 | name : String
74 | The name of the object to be written.
75 | formatting : Lambda (Optional)
76 | Specifies the formatting of the first title line. If not specified, defaults to a tabular formatting for issues and a dud (no formatting) for the rest. The lambda accepts one argument, the text width for the window.
77 |
78 | Returns
79 | -------
80 | int
81 | This represents the line number of the blank line under the header. Intended to be a constant since it's expected that this is written at the top of the file.
82 |
83 | """
84 |
85 | text_width = vim.current.window.width
86 |
87 | postfix = DrawUtil.__type_selector(
88 | board="board",
89 | sprint="sprint",
90 | default="",
91 | obj=obj
92 | )
93 |
94 | if not formatting:
95 | formatting = DrawUtil.__type_selector(
96 | default=lambda w: w,
97 | issue=lambda w: vim.command("1Tabularize /\\u\+-\d\+\s/r0c%dr0" % (text_width-len(name)-7)),
98 | obj=obj
99 | )
100 |
101 | header_str = (name + (" %s" % postfix)).strip()
102 | buf[0] = header_str
103 | buf.append("="*len(header_str))
104 | buf.append("")
105 |
106 | formatting(text_width)
107 |
108 | return 3
109 |
110 | @staticmethod
111 | def draw_item(buf, item, line=None, str_generator=None):
112 | """
113 | Draws an item in the buffer.
114 |
115 | Draws an item on the specified line or at the end of the buffer if no line is specified. Does not apply formatting: formatting is applied when drawing a category.
116 |
117 | Parameters
118 | ----------
119 | buf : vim.buffer
120 | Buffer to be drawn onto
121 | item : tuple
122 | Tuple that contains the key and summary of the item
123 | line : int (Optional)
124 | Line on which to draw the item. If not specified, appends to the end of the buffer
125 | str_generator : Lambda (Optional)
126 | This is a lambda that accepts an item and returns a string that is to be printed. The string can contain multiple lines, in which case the text will be printed line by line and then adjusted. If not specified, joins the key and summary in item with spaces.
127 |
128 | Returns
129 | -------
130 | tuple
131 | the next line, the length of the key, and the length of the summary as a tuple
132 |
133 | """
134 |
135 | if not str_generator:
136 | str_generator = " ".join
137 |
138 | key, summ = item
139 | text = str_generator(item)
140 | line = len(buf)+1 if not line else line
141 |
142 | for strip in text.splitlines():
143 | buf.append(strip, line-1)
144 | line += 1
145 |
146 | return line, len(key), len(summ)
147 |
148 | @staticmethod
149 | def draw_category(buf, obj, category, line=None, more=False, formatter=None, with_header=True, str_generator=None):
150 | """
151 | Draws a category in the buffer.
152 |
153 | Gets a category and draws it in the buffer at the specified line. Also applies formatting afterwards.
154 |
155 | Parameters
156 | ----------
157 | buf : vim.buffer
158 | Buffer to be drawn onto
159 | obj : Object
160 | Object to be examined
161 | category : tuple
162 | Tuple that contains the name of the category and a list of issues
163 | line : int (Optional)
164 | Line to be drawn onto (0-indexed). If none exist, defaults to appending to the file.
165 | more : Boolean (Optional)
166 | Boolean that determines whether a MORE is displayed at the bottom of the items. Defaults to False.
167 | formatter : Lambda (Optional)
168 | Lambda that accepts 5 arguments (
169 | startLine,
170 | endLine,
171 | maxKeyLen,
172 | maxSummLen,
173 | window_width
174 | )
175 | Lambda returns the position of the endLine (since it might be changed through formatting).
176 | The values of the variables should be self-explanatory. If not defined, it's chosen depending on the type of object, dud function for scrum boards and Formatters.ISSUE_FORMATTER otherwise.
177 | with_header : Boolean (Optional)
178 | Boolean that specifies if the header of the category should be displayed. True by default.
179 | str_generator : Lambda (Optional)
180 | Lambda that gets passed in as str_generator field to the draw_item call. Default to None, which in draw_item just adds a space between the key and the summ.
181 |
182 | Returns
183 | -------
184 | int
185 | the line number of the blank line under the last item in the category
186 |
187 | """
188 |
189 | window_width = vim.current.window.width
190 |
191 | # No formatting for the scrum board
192 | formatter = formatter if formatter else DrawUtil.__type_selector(
193 | obj=obj,
194 | scrum=lambda a, b, c, d, e: b,
195 | issue=lambda a, b, c, d, e: b,
196 | default=Formatters.ISSUE_FORMATTER
197 | )
198 |
199 | if not line:
200 | line = len(buf)+1
201 |
202 | if with_header:
203 | buf.append(category[0].upper()+":", line-1)
204 | line += 1
205 | buf.append("-"*(len(category[0])+1), line-1)
206 | line += 1
207 |
208 | startLine = line
209 | items = category[1]
210 | # Using maxSummLen to clarify that we are measuring the maximum length of the summary
211 | maxKeyLen, maxSummLen = 0, 0
212 | for item in items:
213 | line, lenKey, lenSumm = DrawUtil.draw_item(buf, item, line=line, str_generator=str_generator)
214 | maxKeyLen = max([lenKey, maxKeyLen])
215 | maxSummLen = max([lenSumm, maxSummLen])
216 | endLine = line-1
217 |
218 | vim.command("normal! %dG" % endLine)
219 |
220 | endLine = formatter(startLine, endLine, maxKeyLen, maxSummLen, window_width)
221 | line = endLine+1
222 |
223 | if more:
224 | line = DrawUtil.draw_more(buf, line)
225 |
226 | return line
227 |
228 | @staticmethod
229 | def draw_items(buf, obj, sessionStorage, line=None, itemExtractor=None, withCategoryHeaders=True):
230 | """
231 | Draw a set of items from an object.
232 |
233 | This method draws items extracted via itemExtractor from object, and draws them to the buffer.
234 |
235 | Parameters
236 | ----------
237 | buf : vim.buffer
238 | Buffer to be drawn onto
239 | obj : Object
240 | Object from which items will be extracted
241 | sessionStorage : SessionStorage
242 | The sessionStorage object associated with current session.
243 | line : int (Optional)
244 | Line on which to start drawing. If not defined, appends to the end of the buffer
245 | itemExtractor : Lambda (Optional)
246 | Lambda that accepts an object and returns a list of items separated by category. If not defined, defaults to calling the getIssues method of the object. Returns a list of tuples with 3 elements each: the name of the category, the "more" parameter, and the list of item keys.
247 | withCategoryHeaders : Boolean (Optional)
248 | Boolean that determines whether the headers for the categories will be displayed. True by default.
249 |
250 | Returns
251 | -------
252 | int
253 | the line number of the blank line under the last item in the category
254 |
255 | """
256 |
257 | if not line:
258 | line = len(buf)+1
259 |
260 | if not itemExtractor:
261 | itemExtractor = DrawUtil.__type_selector(
262 | obj=obj,
263 | default=lambda o: o.getIssues(),
264 | scrum=lambda o: o.getSprints()
265 | )
266 |
267 | # Associate buffer with object in sessionStorage
268 | addBoardFunc = sessionStorage.assignBoard
269 | addSprintFunc = sessionStorage.assignSprint
270 | dudFunc = lambda a, b: b
271 | DrawUtil.__type_selector(
272 | board=addBoardFunc,
273 | sprint=addSprintFunc,
274 | default=dudFunc,
275 | obj=obj
276 | )(obj, buf)
277 |
278 | extraction = itemExtractor(obj)
279 |
280 | for cat in extraction:
281 | more = cat[1]
282 | item_list = (cat[0], cat[2])
283 | line = DrawUtil.draw_category(buf, obj, item_list, line, more=more, with_header=withCategoryHeaders) + 1
284 | buf.append("", line-2)
285 | return line
286 |
287 | @staticmethod
288 | def draw_more(buf, line=None):
289 | """
290 | Draws the "MORE" symbol for columns representing extracts that have not been fully consumed.
291 |
292 | Parameters
293 | ----------
294 | buf : Buffer
295 | Buffer to be drawn to
296 | line : Integer (Optional)
297 | Line to be drawn on. Defaults to the end of the buffer.
298 |
299 | Returns
300 | -------
301 | Integer
302 | returns line + 1
303 |
304 | """
305 |
306 | if not line:
307 | line = len(buf) + 1
308 |
309 | buf.append("---MORE---", line-1)
310 |
311 | return line+1
312 |
313 | @staticmethod
314 | def set_filetype(obj, filetype=None):
315 | """
316 | Sets filetype in current buffer
317 |
318 | Sets filetype in current buffer depending on the type of object. Recommended to execute this function after you\'ve written any changes since this function with set modifiable to off
319 |
320 | Parameters
321 | ----------
322 | obj : Object
323 | Object to be examined
324 | filetype : String (Optional)
325 | Sets the current buffer to specified filetype unless it's none, then selection is done based on type of object
326 |
327 | Returns
328 | -------
329 | Nothing
330 |
331 | """
332 | if not filetype:
333 | filetype = DrawUtil.__type_selector(
334 | kanban="jirakanbanboardview",
335 | scrum="jirascrumboardview",
336 | sprint="jirasprintview",
337 | board="jiraboardview",
338 | issue="jiraissueview",
339 | search="jirasearchview",
340 | default="",
341 | obj=obj
342 | )
343 |
344 | vim.command("setl filetype=%s" % filetype)
345 |
346 |
--------------------------------------------------------------------------------
/python/util/formatters.py:
--------------------------------------------------------------------------------
1 |
2 | import functools
3 | import vim
4 |
5 | class Formatters:
6 | """
7 | A class for various formatter functions. A formatter function is usually
8 | passed into the DrawUtil.draw_category method. Each formatter must accept
9 | exactly five postiional arguments:
10 | startLine,
11 | endLine,
12 | maxKeyLen,
13 | maxSumLen,
14 | textWidth
15 | You can use keyword arguments to pass in values with FormatterFactory
16 | below. More information about formatter functions can be found in the
17 | documentation for DrawUtil.draw_category method.
18 | """
19 | @staticmethod
20 | def ISSUE_FORMATTER(startLine, endLine, maxKeyLen, maxSumLen, textWidth):
21 | """
22 | This is the formatter for an issue line. The format of the issues is so
23 | that the key is on the left side of the line and the summary is as far
24 | to the right side as possible. This is done by computing the maximum
25 | space between any two issue keys and summaries and inserting it in
26 | between the keys and summaries as a "tab". This is the reason why the
27 | min_space_between variable exists.
28 | """
29 |
30 | # -7 offset is screen specific, seems it's necessary for normal displays (??)
31 | min_space_between = textWidth-maxKeyLen-maxSumLen-7
32 | vim.command("%d,%dTabularize /\\u\+-\d\+\s/r0l%dr0" % (startLine, endLine, min_space_between))
33 | return endLine
34 |
35 | @staticmethod
36 | def DISPLAY_FIELDS_FORMATTER(startLine, endLine, *args):
37 | """
38 | This is the formatter for the Display Fields of an Issue object. This
39 | method takes the startLine, and formats everything until the endLine,
40 | inclusive, with `gqq`.
41 | """
42 | vim.command("normal! %dG" % startLine)
43 | vim.command("normal! %dgqq" % (endLine - startLine + 1))
44 | return vim.current.window.cursor[0]
45 |
46 |
47 | @staticmethod
48 | def COMMENT_FORMATTER(startLine, endLine, *args, number_of_comments=1):
49 | """
50 | This is the formatter for the Comment section of an issue view. It
51 | formats each single comment one at a time with `gq`, which is why the
52 | number of comments is needed to perform this operation. It uses
53 | mappings defined in `ftplugin/jiraissueview.vim` to select the comment
54 | and navigate between them.
55 | """
56 | vim.command("normal! %dG" % startLine)
57 | for _ in range(number_of_comments):
58 | vim.command("silent exe \"normal gqncc\"")
59 | vim.command("silent exe \'/\' . b:commentPattern")
60 | return vim.current.window.cursor[0]
61 |
62 | class FormatterFactory:
63 | """
64 | This is factory for creating formatters that rely on more parameters than
65 | passed in, that is that depend on more values than the five that define a
66 | formatter function. This classes uses the partial to return a formatter
67 | with all of the keyword arguments pre-filled, so that you can pass the
68 | function to the draw_category method.
69 | """
70 | @staticmethod
71 | def get_comment_formatter(number_of_comments):
72 | return functools.partial(Formatters.COMMENT_FORMATTER, number_of_comments=number_of_comments)
73 |
--------------------------------------------------------------------------------
/python/util/itemCategorizer.py:
--------------------------------------------------------------------------------
1 |
2 | class ItemCategorizer():
3 |
4 | @staticmethod
5 | def issueCategorizer(issues, statusToColumn, columnExtractors):
6 | """
7 | Categorizes issues based on category.
8 |
9 | Categorizes issues based on the status to column mappings. NOTE: THIS DOES NOT CREATE ISSUE OBJECTS
10 |
11 | Parameters
12 | ----------
13 | issues : String
14 | A json string containing an "issues" field that contains an array of issues to be processed.
15 | statusToColumn : Dict
16 | A dictionary that maps status to columns. This is a many to one relationship.
17 | columnExtractos : Dict
18 | A dictionary that maps columns to the extractor. Used only to assign the "more" parameter, that is to see if the extractor is finished.
19 |
20 | Returns
21 | -------
22 | List
23 | a list that contains tuples of (column, ) for each column in the columnToIssues dict.
24 |
25 | """
26 |
27 | columnToIssues = {}
28 | for i in issues:
29 | key = (i["key"], i["fields"]["summary"])
30 | statusId = i["fields"]["status"]["id"]
31 | column = statusToColumn[statusId]
32 | if column not in columnToIssues:
33 | columnToIssues[column] = list()
34 | columnToIssues[column].append(key)
35 | return [(a, not columnExtractors[a].finished, b) for a, b in columnToIssues.items() if len(b) > 0]
36 |
--------------------------------------------------------------------------------
/python/util/itemExtractor.py:
--------------------------------------------------------------------------------
1 |
2 | class ObjectItemExtractor:
3 | """
4 | This class is designed to be an iterator over issues presented by methods of the JIRA object
5 | """
6 |
7 | def __init__(self, provider, batch_size=10):
8 | """
9 | Initializes an item extractor from a function.
10 |
11 | Unlike its counterpart above, this class is better suited to extract results from a JIRA object function. You specify the function, and then this will return an extractor of issues with that given function.
12 |
13 | Parameters
14 | ----------
15 | provider : Lambda
16 | The provider function is a function that takes two keyword arguments: startAt and maxResults. The result is a list of items (it must be an object such that passing it to the len() function should return the number of items).
17 | batch_size : Integer (Optional)
18 | This is an integer that specifies the batch_size, used mostly to specify the "maxResults" parameter of the provider function. Defaults to 10.
19 |
20 | Returns
21 | -------
22 | Nothing
23 |
24 | """
25 |
26 | self.start_at_marker = 0
27 | self.provider = provider
28 | self.batch_size = 10
29 | self.finished = False
30 |
31 | def __iter__(self):
32 | return self
33 |
34 | def __next__(self):
35 | if self.finished:
36 | return []
37 | results = self.provider(self.start_at_marker, self.batch_size)
38 | num_items = len(results)
39 | if num_items < self.batch_size:
40 | self.finished = True
41 | self.start_at_marker += num_items
42 | return results
43 |
44 | def reset(self):
45 | self.start_at_marker = 0
46 | self.finished = False
47 |
48 | @staticmethod
49 | def create_column_issue_extractor(board, column, batch_size=10):
50 | """
51 | Creates a simple extractor for issues from a certain column
52 |
53 | Creates an extractor for issues in a column. This is to replace the previously used CustomRequestItemExtractor class.
54 |
55 | Parameters
56 | ----------
57 | board : Board
58 | Board from which the issues will be extracted.
59 | column : String
60 | Name of the column to be matched
61 | batch_size : Integer (Optional)
62 | Batch size. Defaults to 10.
63 |
64 | Returns
65 | -------
66 | ObjectItemExtractor
67 | """
68 | def provider(startAt, maxResults=batch_size):
69 | connection_string = board.baseUrl+"/issue?fields=%s"
70 | req_fields_list = ','.join(board.requiredProperties)
71 | req_status_list = ','.join(['\'%s\'' % k for k, v in board.statusToColumn.items() if v == column])
72 | req_vars = (req_fields_list,) + (startAt, maxResults)
73 | if req_status_list:
74 | connection_string += "&jql=status IN (%s)"
75 | req_vars = list(req_vars)
76 | req_vars.insert(1, req_status_list)
77 | req_vars = tuple(req_vars)
78 | request_string = (connection_string + "&startAt=%d&maxResults=%d") % (req_vars)
79 |
80 | response = board.connection.customRequest(request_string).json()
81 | return response["issues"]
82 | return ObjectItemExtractor(provider, batch_size=batch_size)
83 |
84 | @staticmethod
85 | def create_search_extractor(connection, query, batch_size=10):
86 | """
87 | Create a simple extractor for a search query.
88 |
89 | This creates an ObjectItemExtractor from a connection and a search query. It usses the search_issues method of the JIRA object.
90 |
91 | Parameters
92 | ----------
93 | connection : Connection
94 | A connection object from which the JIRA object is extracted.
95 | query : String
96 | A search query. This is inputted into the search_issues method of the JIRA object.
97 | batch_size : Integer (Optional)
98 | Batch size for the issue extraction. Defaults to 10.
99 |
100 | Returns
101 | -------
102 | ObjectItemExtractor
103 | """
104 | provider = lambda startAt, maxResults: connection.getJiraObject().search_issues(query, startAt=startAt, maxResults=maxResults)
105 | return ObjectItemExtractor(provider, batch_size)
106 |
107 |
--------------------------------------------------------------------------------
/python/util/pip_check.py:
--------------------------------------------------------------------------------
1 |
2 | import os
3 | import pkg_resources
4 |
5 | ###
6 | # This was obtained from https://stackoverflow.com/questions/16294819/check-if-my-python-has-all-required-packages
7 | ###
8 |
9 | def check():
10 |
11 | # dependencies can be any iterable with strings,
12 | # e.g. file line-by-line iterator
13 | dependencies = []
14 | dir_path = os.path.dirname(os.path.realpath(__file__))
15 |
16 | with open(dir_path + "/../../requirements.txt", 'rb') as f:
17 | for line in f:
18 | requirement = line.decode('ascii').rstrip()
19 | if requirement:
20 | dependencies += [requirement]
21 |
22 | # here, if a dependency is not met, a DistributionNotFound or VersionConflict
23 | # exception is thrown.
24 | for dependency in dependencies:
25 | try:
26 | pkg_resources.require(dependency)
27 | except pkg_resources.ContextualVersionConflict as e:
28 | continue
29 | except (pkg_resources.DistributionNotFound, pkg_resources.VersionConflict) as e:
30 | print(e)
31 | return 1
32 | except Exception as e:
33 | return 1
34 | return 0
35 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 |
2 | requests >= 2.0.0
3 | jira >= 2.0.0
4 |
--------------------------------------------------------------------------------
/syntax/jiraboardview.vim:
--------------------------------------------------------------------------------
1 |
2 | setlocal cursorline
3 | highlight! link CursorLine Cursor
4 |
--------------------------------------------------------------------------------
/syntax/jiraissueview.vim:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/syntax/jirakanbanboardview.vim:
--------------------------------------------------------------------------------
1 | execute "source " . expand(":h:p") . "/jiraboardview.vim"
2 |
--------------------------------------------------------------------------------
/syntax/jirascrumboardview.vim:
--------------------------------------------------------------------------------
1 | execute "source " . expand(":h:p") . "/jiraboardview.vim"
2 |
--------------------------------------------------------------------------------
/syntax/jirasprintview.vim:
--------------------------------------------------------------------------------
1 | execute "source " . expand(":h:p") . "/jiraboardview.vim"
2 |
--------------------------------------------------------------------------------
/test/boardcolumnordering.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Open the test board):
3 | JiraVimBoardOpen TEST
4 |
5 | Then (Test Order):
6 | Assert getline(1) ==# "TEST board", "No header found"
7 | Assert getline(2) ==# "==========", "No underlining found"
8 |
9 | /BACKLOG
10 | let b:backlogLine = line(".")
11 |
12 | /SELECTED\ FOR\ DEVELOPMENT
13 | let b:developmentLine = line(".")
14 |
15 | /IN\ PROGRESS
16 | let b:progressLine = line(".")
17 |
18 | /DONE
19 | let b:doneLine = line(".")
20 |
21 | Assert b:backlogLine < b:developmentLine, "Bad ordering"
22 | Assert b:developmentLine < b:progressLine, "Bad ordering"
23 | Assert b:progressLine < b:doneLine, "Bad ordering"
24 |
--------------------------------------------------------------------------------
/test/boardissueordering.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Open the test board):
3 | JiraVimBoardOpen TEST
4 |
5 | Then (Test Order):
6 | Assert getline(1) ==# "TEST board", "No header found"
7 | Assert getline(2) ==# "==========", "No underlining found"
8 |
9 | /BACKLOG
10 | normal! 3j
11 |
12 | while getline(".") !~? '\v---MORE---'
13 | let b:thisIssue = substitute(matchstr(getline("."), '\v^\u+-\d+'), '\v^\u+-', "", '')
14 | let b:prevIssue = substitute(matchstr(getline(line(".")-1), '\v^\u+-\d+'), '\v^\u+-', "", '')
15 | Assert str2nr(b:prevIssue) < str2nr(b:thisIssue), "Bad ordering or Issues"
16 | normal! j
17 | endwhile
18 |
--------------------------------------------------------------------------------
/test/headlessissuereturn.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Open the issue):
3 | JiraVimIssueOpen TEST-4
4 |
5 | Then (Make sure it's an actual issue):
6 | normal! gg
7 | AssertNotEqual -1, match(getline("."), '\v^(\u+)-\d+\s+\1$'), "No Header found"
8 |
9 | " Attempt return
10 | AssertThrows :JiraVimReturn
11 | Log g:vader_exception
12 | AssertNotEqual -1, match(g:vader_exception, '\v^Could not identify the return board buffer\c')
13 |
--------------------------------------------------------------------------------
/test/loadmorebacklog.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Load more Backlog):
3 | JiraVimBoardOpen TEST
4 | /BACKLOG
5 | let b:backlogLine = line(".")
6 | /MORE
7 | let b:moreLine = line(".")
8 | JiraVimLoadMore
9 | sleep 2
10 |
11 | Then (Make sure that more issues load):
12 | execute ":" . b:backlogLine
13 | Assert getline(".") =~# '\v^BACKLOG:', "Match didn't happen in backlog section"
14 | execute ":" . b:moreLine
15 | Assert getline(".") =~# '\v^TEST-\d+\s+.+', "No more issues were loaded"
16 | Assert getline(".") !=? getline(b:backlogLine + 2), "Reloading old issues"
17 | try
18 | /MORE
19 | let b:newMoreLine = line(".")
20 | catch /Pattern\ not\ found:\ MORE/
21 | let b:newMoreLine = b:moreLine + 1
22 | endtry
23 | Assert b:newMoreLine > b:moreLine, "MORE line didn't move"
24 |
--------------------------------------------------------------------------------
/test/loadmoreinsprint.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Load more from To Do):
3 | execute "JiraVimBoardOpen A second"
4 | /Sprint 1
5 | JiraVimSelectSprint
6 | /TO DO
7 | let b:todoline = line(".")
8 | /MORE
9 | let b:moreLine = line(".")
10 | JiraVimLoadMore
11 | sleep 2
12 |
13 | Then (Make sure that more issues load):
14 | execute ":" . b:todoline
15 | Assert getline(".") =~# '\v^TO DO:', "Match didn't happen in backlog section"
16 | execute ":" . b:moreLine
17 | Assert getline(".") =~# '\v^TEST-\d+\s+.+', "No more issues were loaded"
18 | Assert getline(".") !=? getline(b:todoline + 2), "Reloading old issues"
19 | try
20 | /MORE
21 | let b:newMoreLine = line(".")
22 | catch /Pattern\ not\ found:\ MORE/
23 | let b:newMoreLine = b:moreLine + 1
24 | endtry
25 | Assert b:newMoreLine > b:moreLine, "MORE line didn't move"
26 |
--------------------------------------------------------------------------------
/test/openboardwithoutsuffix.vader:
--------------------------------------------------------------------------------
1 | " This test is to test for a board that doens't happen to have a "board" suffix.
2 |
3 | Execute (Open the special board):
4 | JiraVimBoardOpen TES
5 | sleep 2
6 |
7 | Then (Expect header to appear and the columns):
8 | Assert getline(1) ==# "TES board", "No header found"
9 | Assert getline(2) ==# "=========", "No underlining found"
10 |
11 | " Find the TODO category
12 | /ALL\ ISSUES
13 | Assert getline(".") =~# "ALL ISSUES:", "No To Do section"
14 | normal! j
15 | Assert getline(".") ==# "-----------", "No underlining for To Do section"
16 |
17 | " Make sure there is at least an issue properly formatted
18 | normal! j
19 | Assert getline(".") =~# '\v^TES\-\d+\s*.*$', "No issue in To Do"
20 |
--------------------------------------------------------------------------------
/test/openissue.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Open an issue):
3 | " Open issue in current window
4 | JiraVimBoardOpen TEST
5 | sleep 1
6 | /BACKLOG
7 | normal! 2j
8 | JiraVimSelectIssueNosp
9 | sleep 1
10 |
11 | Then (Expect header to appear and a description):
12 | normal! gg
13 | AssertNotEqual -1, match(getline("."), '\v^(\u+)-\d+\s+\1$'), "No Header found"
14 | normal! j
15 | AssertNotEqual -1, match(getline("."), '\v^\=+$'), "No Underlining found for header"
16 |
17 | let b:curLine = line(".")
18 | /\v\c^Summary
19 | AssertNotEqual b:curLine, line("."), "No Summary section found"
20 |
21 | let b:curLine = line(".")
22 | /\v\c^Description
23 | AssertNotEqual b:curLine, line("."), "No Description section found"
24 |
25 |
26 |
--------------------------------------------------------------------------------
/test/openissuesp.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Open an issue):
3 | JiraVimBoardOpen TEST
4 | let g:boardBufferNumber = bufnr("%")
5 | /BACKLOG
6 | normal! 2j
7 | JiraVimSelectIssueSp
8 | sleep 1
9 |
10 | Then (Expect a header to appear):
11 | AssertNotEqual bufwinnr(g:boardBufferNumber), winnr(), "A new window was not opened"
12 | normal! gg
13 | AssertNotEqual -1, match(getline("."), '\v^(\u+)-\d+\s+\1$'), "No Header found"
14 | normal! j
15 | AssertNotEqual -1, match(getline("."), '\v^\=+$'), "No Underlining found for header"
16 |
--------------------------------------------------------------------------------
/test/openissuewithformatting.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Open issue TEST-16):
3 | JiraVimIssueOpen TEST-16
4 | sleep 1
5 |
6 | Then (Make sure it's a real issue and check that the text width is smaller than textwidth):
7 | normal! gg
8 | AssertNotEqual -1, match(getline("."), '\v^(\u+)-\d+\s+\1$'), "No Header found"
9 | normal! j
10 | AssertNotEqual -1, match(getline("."), '\v^\=+$'), "No Underlining found for header"
11 |
12 | let b:curLine = line(".")
13 | /\v\c^Summary
14 | AssertNotEqual b:curLine, line("."), "No Summary section found"
15 |
16 | let b:curLine = line(".")
17 | /\v\c^Description
18 | AssertNotEqual b:curLine, line("."), "No Description section found"
19 |
20 | let b:tw = &textwidth
21 | if b:tw == 0
22 | " Default for auto-formatting if textwidth is set to 0
23 | let b:tw = 79
24 | endif
25 |
26 | while line(".") < line("$")
27 | Assert strlen(getline(".")) <= b:tw
28 | normal! j
29 | endwhile
30 |
31 | Assert strlen(getline(".")) <= b:tw
32 |
--------------------------------------------------------------------------------
/test/opensearch.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Open the search):
3 | execute "JiraVimSearchOpen type=story"
4 | /SEARCH RESULTS
5 | let b:searchResultLine = line(".")
6 | /MORE
7 | let b:moreLine = line(".")
8 | JiraVimLoadMore
9 | sleep 2
10 |
11 | Then (Expect header to appear):
12 | Assert getline(1) =~# "Search for \"type=story\"", "No header found"
13 | Assert getline(2) ==# "=======================", "No underlining found"
14 |
15 | Assert getline(b:searchResultLine) =~# "SEARCH RESULTS:", "No Search result section"
16 | Assert getline(b:searchResultLine+1) ==# "---------------", "No underlining for search result section"
17 | Assert getline(b:searchResultLine+2) =~# '\v^TEST\-\d+\s+.+$', "No results for search"
18 |
19 | execute ":" . b:moreLine
20 | Assert getline(".") =~# '\v^TEST-\d+\s+.+', "No more issues were loaded"
21 |
22 | try
23 | /MORE
24 | let b:newMoreLine = line(".")
25 | catch /Pattern\ not\ found:\ MORE/
26 | let b:newMoreLine = b:moreLine + 1
27 | endtry
28 | Assert b:newMoreLine > b:moreLine, "MORE line didn't move"
29 |
--------------------------------------------------------------------------------
/test/opensecondboard.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Open the second board):
3 | execute "JiraVimBoardOpen A second"
4 | sleep 2
5 |
6 | Then (Expect header to appear and the sprint list):
7 | Assert getline(1) ==# "A second board", "No header found"
8 | Assert getline(2) ==# "==============", "No underlining found"
9 |
10 | /SPRINTS
11 | Assert getline(".") =~# "SPRINTS:", "No Sprint section"
12 | normal! j
13 | Assert getline(".") ==# "--------", "No underlining for sprint section"
14 |
15 | " Make sure that the line only contains spaces and alphanumeric characters
16 | normal! j
17 | AssertNotEqual "", matchstr(getline("."), '\v^[[:alnum:][:space:]]+$'), "Sprint line is abnormal"
18 |
--------------------------------------------------------------------------------
/test/openspaceboard.vader:
--------------------------------------------------------------------------------
1 | " This test is to test opening of a board that has a space in the middle, in this case Space Jam
2 |
3 | Execute (Open the special board):
4 | JiraVimBoardOpen Space Jam
5 | sleep 2
6 |
7 | Then (Expect header to appear and the columns):
8 | Assert getline(1) ==# "Space Jam board", "No header found"
9 | Assert getline(2) ==# "===============", "No underlining found"
10 |
11 | " Find the TODO category
12 | /TO\ DO
13 | Assert getline(".") =~# "TO DO:", "No To Do section"
14 | normal! j
15 | Assert getline(".") ==# "------", "No underlining for To Do section"
16 |
17 | " Make sure there is at least an issue properly formatted
18 | normal! j
19 | Assert getline(".") =~# '\v^TEST\-\d+\s*.*$', "No issue in To Do"
20 |
--------------------------------------------------------------------------------
/test/opentestboard.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Open the test board):
3 | JiraVimBoardOpen TEST
4 | sleep 2
5 |
6 | Then (Expect header to appear and the columns):
7 | Assert getline(1) ==# "TEST board", "No header found"
8 | Assert getline(2) ==# "==========", "No underlining found"
9 |
10 | " Find the BACKLOG category
11 | /BACKLOG
12 | Assert getline(".") =~# "BACKLOG:", "No Backlog section"
13 | normal! j
14 | Assert getline(".") ==# "--------", "No underlining for backlog section"
15 |
16 | " Make sure there is at least an issue properly formatted
17 | normal! j
18 | Assert getline(".") =~# '\v^TEST\-\d+\s*.*$', "No issue in Backlog"
19 |
--------------------------------------------------------------------------------
/test/opentestboardnosp.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Record window number and then open board in nosplit):
3 | let g:originalWinNumber = winnr()
4 | JiraVimBoardOpenNosp TEST
5 | let g:newWinNumber = winnr()
6 |
7 | Then (Test that this is actuall the TEST board and compare window numbers):
8 | Assert g:originalWinNumber ==# g:newWinNumber, "Board opened in a new buffer"
9 |
10 | Assert getline(1) ==# "TEST board", "No header found"
11 | Assert getline(2) ==# "==========", "No underlining found"
12 |
13 | " Find the BACKLOG category
14 | /BACKLOG
15 | Assert getline(".") =~# "BACKLOG:", "No Backlog section"
16 | normal! j
17 | Assert getline(".") ==# "--------", "No underlining for backlog section"
18 |
19 | " Make sure there is at least an issue properly formatted
20 | normal! j
21 | Assert getline(".") =~# '\v^TEST\-\d+\s*.*$', "No issue in Backlog"
22 |
--------------------------------------------------------------------------------
/test/returntoboard.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Open the board):
3 | JiraVimBoardOpen TEST
4 | let w:boardNumber = bufnr("%")
5 | /BACKLOG
6 | normal! 2j
7 | JiraVimSelectIssueNosp
8 | JiraVimReturn
9 |
10 | Then (Make sure that it's actually the TEST board):
11 | Assert getline(1) ==# "TEST board", "No header found"
12 | Assert getline(2) ==# "==========", "No underlining found"
13 |
14 | " Find the BACKLOG category
15 | /BACKLOG
16 | Assert getline(".") =~# "BACKLOG:", "No Backlog section"
17 | normal! j
18 | Assert getline(".") ==# "--------", "No underlining for backlog section"
19 |
20 | " Make sure there is at least an issue properly formatted
21 | normal! j
22 | Assert getline(".") =~# '\v^TEST\-\d+\s*.*$', "No issue in Backlog"
23 |
--------------------------------------------------------------------------------
/test/returntoboardsplit.vader:
--------------------------------------------------------------------------------
1 |
2 | Execute (Open the board):
3 | JiraVimBoardOpen TEST
4 | let g:boardBufferNumber = bufnr("%")
5 | /BACKLOG
6 | normal! 2j
7 | JiraVimSelectIssueSp
8 | JiraVimReturn
9 |
10 | Then (Make sure that it's the TEST board and that it's the same window):
11 | Assert getline(1) ==# "TEST board", "No header found"
12 | Assert getline(2) ==# "==========", "No underlining found"
13 |
14 | AssertEqual bufwinnr(g:boardBufferNumber), winnr(), "Didn't come back to the previous window"
15 |
16 |
--------------------------------------------------------------------------------