Commit graph

29 commits

Author SHA1 Message Date
William Martin
60f248458c Issue lock early arg parsing 2025-04-17 15:27:39 +02:00
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
William Martin
5007c18f5f Fix unused params across project 2024-05-07 17:50:43 +02:00
Andy Feller
bcdc917f08 Enhance 2nd round of issue and PR number output 2024-03-01 15:42:43 -05:00
vilmibm
c3cceae9ea finish tests 2022-12-20 15:45:13 -08:00
vilmibm
cee5e6e42a WIP on tests 2022-12-20 13:00:52 -08:00
vilmibm
95419f9006 further WIP 2022-12-19 18:12:08 -08:00
vilmibm
4c28e32e9d WIP on adding tests, add prompt, tweak things 2022-12-19 17:57:04 -08:00
vilmibm
b52d452168 wip: tweak output, update to Prompter, start on tests 2022-12-16 13:01:09 -08:00
chemotaxis
077ab39738 Implicitly return the nil value when no lock reason given
While I usually like explicitly setting all values, getting rid of
setting the empty string streamlines map construction and testing.

The reasonsMap will return the nil value because the empty string is not
in the map.
2022-08-23 23:16:15 -04:00
chemotaxis
4bb6e0d585 Alphabetize fields 2022-08-23 14:29:21 -04:00
chemotaxis
2970555cea Update comments 2022-08-23 14:24:13 -04:00
chemotaxis
cf822e4d9c Remove direct calls to graphql library
Similar to commit 45f1a71c8b
2022-08-23 01:35:19 -04:00
chemotaxis
718bb80fbd Add failure icon 2022-04-29 00:30:02 -04:00
chemotaxis
11fde2ee29 Restructured switch statement
As much as I like keeping statements as flat as possible, this
not-as-flat revision just seems easier to read.
2022-04-29 00:23:36 -04:00
chemotaxis
3723ab9230 Polished things 2022-04-29 00:23:36 -04:00
chemotaxis
c429726b53 Polished error message 2022-04-29 00:23:36 -04:00
chemotaxis
e0573fa68d Use if/else if on error checking
Use switch statements for regular branching code.
2022-04-29 00:23:36 -04:00
chemotaxis
fc1b929a81 Remove opts.PadlockState
I noticed that PadlockState didn't really have anything to do with the
LockOptions and it was easy to call an incorrect locking function that
didn't match the PadlockState.

Now, you pass in the state as an argument and you simply call the
appropriate function instead of setting PadlockState and then calling
the correct function.

- Other touch ups and refactoring
2022-04-29 00:23:36 -04:00
chemotaxis
8918cf6815 Skip unlock api call if already unlocked 2022-04-29 00:23:36 -04:00
chemotaxis
7504f5ec00 Remove opts.PadlockState
Rather than saving the intended lock state and calling a method
depending on the lock state, just call the method directly.  By the time
you need to the padlock state, you already know which method to use; no
need to first change the lock state than call the method.

Also, refactored print/error messages that are conditional.
2022-04-29 00:19:28 -04:00
chemotaxis
32f8283c77 Refactor things
- Switch to underscores
- Revise error message
2022-04-29 00:17:53 -04:00
chemotaxis
e019ff9f02 Modify documentation if called from issue or pr 2022-04-28 23:56:13 -04:00
chemotaxis
364dd38bc0 Get graphql queries and mutations working
- Fix error if found an issue while using `gh pr lock/unlock` or vice versa
- Added additional types
- Used githubv4 types
- Added "relock" state
    - If the conversation is already locked you have two choices: try to
      lock it again or do nothing.  Do nothing is easy.  But, if you
      want to change the lock reason, you need to first unlock the
      conversation and then lock it again.
- Added survey to confirm if you want to relock
- Added formatted print statements
2022-04-28 23:54:22 -04:00
chemotaxis
fa470fc499 Rearrange 2022-04-11 00:38:13 -04:00
chemotaxis
ffcda8fdd4 Map parent commands to typenames 2022-04-11 00:38:13 -04:00
chemotaxis
4b226b1bf8 Other changes
- Changed function to method
- Moved additional common options to method
- Remove redundant documentation
    - Cobra sets documentation in the Command struct.
2022-04-11 00:37:14 -04:00
chemotaxis
631bea2e6d Draft first design
As originally designed in the issue discussion, a single function
`NewCmdLock()` with a parameter to lock or unlock was proposed.
However, after playing around with a couple different designs, it seems
best to create two separate public functions and one private function to
do the common work.

Using two public functions seems to make sense because the api for
locking is different from the api for unlocking.  Therefore, the
documentation for both are different and keeping them in separate
functions would make it easier to maintain the documentation.
2022-04-11 00:36:42 -04:00
chemotaxis
e25c36a7b1 Stub out files for lock command
Lock will lock and unlock both issues and pull requests
2022-03-19 16:58:51 -04:00