diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 747f070..0000000 --- a/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -**/** \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 115a25d..0000000 --- a/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -/coverage -/.idea/ -**/node_modules -.gtt.yml -.DS_STORE -yarn-error.log -**/._* -out diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 71d9c2d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -language: node_js -node_js: - - "6" - - "6.11" - - "8" - - "10" -cache: yarn -script: -- yarn build -deploy: - provider: releases - api_key: - secure: "q1kPg8zNInr1zrEsFvuX4r/Sp0DntK9m8uIi6PqpFNci3HnKEx6aLTe6eVaDpBfMyk+OqAxhyyytDmH36OhfEeDFzuR4wnzRM6LI0pJa9faWohY8CXke2/V6mWRGDorSDKUJ2FriJGL4p/hE2jw1ms/tQh7EsYE1ch3HcIKwkuHKhOVw84I4wW0VNHBMQ/RSnWnUENVO9Tfj/jHlZyltADAgJxRhQd9xg4lTyy95lMoM1eTjyrUiiVg9MPxLj8Mzv5mXbRCASxTziS/FBPrOOB8sMIyfN7cL8/e8hfMTuiWBmfWNaRrQTenLpm1IXobV8oANKg6DqS+cawN/zp9AIXsfzOksQib2tswbCBNY9Vj3tNSTpTLuyTFVvvlB/vNB715oTJX0cuHp8e4nW6AqP1DKUTTELwR1lji0YyGLIFQEw9RcTBP0e3LHXuXjgE80iypsZQQVNIHgIiNNvc1VEMJYECkeHsXt5LblMoJcw+tI7JL6LL3gv3g9j/3/dLvlfTBiXJPTxTlPl0zFvM31t4edGkmfVIRFxjpCGnrOfAnclmDt/r8u3A4i29FovbfIRTkEA+naQQWJvjXmkqTTBbAtOCFROT23EcydEoaE2uYI6Dc0AGPnoeZ3NSTRNvT2SjnotyXT0vVFfDIuB4FLtrX7kNEtHvNkBNzptS28i8E=" - file_glob: true - file: out/* - skip_cleanup: true - on: - tags: true -after_success: -- yarn run coveralls diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 73931f4..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,75 +0,0 @@ -# Contributing - -## How to test the basic functions of gtt - -Create a new project on GitLab if you haven't done so already and write down the project path. e.g. `kriskbx/example-project`. To test groups and subgroups, create a new group with at least one subgroup. Add a new project to both the parent group (e.g. `example-group`) and the subgroup (e.g. `example-group/example-subgroup`) and write down the paths of all the projects and groups. Create at least two issues (write down their id e.g. `42`, `43`) and one merge request (e.g. `13`) in all projects. Or just use our public group over here: https://gitlab.com/gtt - -Then run the following basic commands and check that they work as expected: - -``` -# Test config command -gtt config - -# Test basic time tracking -gtt start "kriskbx/example-project" 42 -gtt stop -gtt log - -# Test cancelling -gtt start "kriskbx/example-project" 42 -gtt cancel -gtt log - -# Test merge request -gtt start --type=merge_request "kriskbx/example-project" 13 -gtt stop -gtt log - -# Test issue creation -gtt create "krisbxkbx/example-project" "New Issue" -gtt stop -gtt log - -# Test editing -gtt edit - -# Test deletion -gtt start "kriskbx/example-project" 42 -gtt stop -gtt delete - -# Test sync, check out issues on GitLab if changes are synced correctly -gtt sync - -# Test basic report -gtt report "kriskbx/example-project" - -# Test report for a single issue and multiple issues -gtt report "kriskbx/example-project" 42 -gtt report "kriskbx/example-project" 42 43 - -# Test report for a group -gtt report --type=group "example-group" -gtt report --type=group --subgroups "example-group" - -# Test combined reports -gtt report "kriskbx/example-project" "example-group/example-project" - -# Test outputs -gtt report --output=table "kriskbx/example-project" -gtt report --output=markdown "kriskbx/example-project" -gtt report --output=csv "kriskbx/example-project" -gtt report --output=pdf --file=test.pdf "kriskbx/example-project" -gtt report --output=xlsx --file=test.xlsx "kriskbx/example-project" - -# Test timeframes (adjust the values so it includes/excludes your issues) -gtt report --from="2020-06-02" --to="2020-06-03" "kriskbx/example-project" - -# Test filtering (you might need to add milestones, labels and additional stuff to properly test this) -gtt report --closed "kriskbx/example-project" -gtt report --user=username "kriskbx/example-project" -gtt report --milestone=milestone_name "kriskbx/example-project" -gtt report --include_by_labels=critical "kriskbx/example-project" -gtt report --exclude_by_labels=ignore "kriskbx/example-project" -gtt report --query=issues "kriskbx/example-project" -``` diff --git a/Dockerfile b/Dockerfile deleted file mode 100755 index 2d9509f..0000000 --- a/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM node:8.2.1-alpine - -ENV GTT_VERSION 1.7.39 -ENV EDITOR vi - -WORKDIR /pwd - -RUN yarn global add --prefix /usr/local "gitlab-time-tracker@$GTT_VERSION" - -VOLUME ["/root", "/pwd"] -ENTRYPOINT ["gtt"] -CMD ["--help"] diff --git a/LICENSE b/LICENSE deleted file mode 100755 index 23cb790..0000000 --- a/LICENSE +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {description} - Copyright (C) {year} {fullname} - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - {signature of Ty Coon}, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/apsit b/apsit new file mode 100644 index 0000000..e69de29 diff --git a/documentation.md b/documentation.md deleted file mode 100644 index 41fe224..0000000 --- a/documentation.md +++ /dev/null @@ -1,829 +0,0 @@ -# gtt documentation - -## contents - -* [requirements](#requirements) -* [installation](#installation) -* [updating](#updating) -* [docker](#docker) -* [commands](#commands) - * [I) configuration](#i-configuration) - * [II) time tracking](#ii-time-tracking) - * [III) reports](#iii-reports) -* [configuration](#configuration) - * [config file](#config-file) - * [time format](#time-format) -* [how to use gtt as a library](#how-to-use-gtt-as-a-library) -* [dumps](#dumps) -* [faqs](#faqs) -* [contributing](#contributing) -* [support further development 🍺](#support-further-development) -* [license](#license) - -## requirements - -* [node.js](https://nodejs.org/en/download) version >= 6 -* [npm](https://github.com/npm/npm) or [yarn](https://yarnpkg.com/en/docs/install) - -## installation - -Install the gtt command line interface using yarn: - -```shell -yarn global add gitlab-time-tracker --prefix /usr/local -``` - -... or download a compiled binary from [here](https://github.com/kriskbx/gitlab-time-tracker/releases) and put it into your `PATH`. - -Run the config command to create a config file and open it in your default editor. -In linux terminal, you must set your preferred editor in the environment. For example, use `export EDITOR=vim` to edit the files with vim (put this in `.bashrc` or similar to have it always configured). -If nothing happens, open the file manually: `~/.local/share/.gtt` - on Windows: `C:\Users\YourUserName\.gtt\config.yml` - -```shell -gtt config -``` - -Add your GitLab API url and your [GitLab API personal token](https://gitlab.com/profile/personal_access_tokens) -to the config file and save it afterwards. **You need to activate the `api` scope when creating your access token.** - -```yaml -url: https://gitlab.com/api/v4/ -token: 01234567891011 -``` - -## updating - -**Updating from version <= 1.5? Please [click here](https://github.com/kriskbx/gitlab-time-tracker/blob/master/upgrade.md)!** - -Update gtt via yarn: - -```shell -yarn global upgrade gitlab-time-tracker -``` - -## docker - -You don't need to have node and gtt installed on your system in order to use gtt, -you can use the official [Docker image](https://hub.docker.com/r/kriskbx/gitlab-time-tracker) as well: - -```shell -docker run \ - --rm -it \ - -v ~:/root \ - -v $(pwd):/pwd \ - kriskbx/gitlab-time-tracker \ - --help -``` - -`--rm` removes the container after running, `-it` makes it interactive, `-v ~:/root` mounts your home directory to the -home directory inside the container, `-v $(pwd):/pwd` mounts current directory inside the container to gtt be able to read local config. If you want to store the config in another place, mount another directory: - - - ```shell - docker run \ - --rm -it \ - -v /path/to/gtt-config:/root \ - kriskbx/gitlab-time-tracker \ - --help - ``` - -... or use a Docker volume: - -```shell -docker volume create gtt-config - -docker run \ - --rm -it \ - -v gtt-config:/root \ - kriskbx/gitlab-time-tracker \ - --help -``` - -I highly recommend creating an alias and adding it to your `bashrc`: - -```shell -echo "alias gtt='docker run --rm -it -v ~:/root -v $(pwd):/pwd kriskbx/gitlab-time-tracker'" >>~/.bashrc -``` - -Now you can simply write `gtt` instead of the bulky Docker command before. Try it out: `gtt --help` - -**Note:** If you want to save reports via the `--file` parameter, make sure to save them in `/root` or another -mounted directory that you have access to on your host machine. Take a look at the [Docker documentation](https://docs.docker.com/engine/tutorials/dockervolumes/) about how Dopcker handles data and volumes. - -## commands - -### I) configuration - -*[Click here](#configuration) for a complete list of configuration options.* - -**Edit/create the global configuration file, stored in your home directory:** - -```shell -gtt config -``` - -If nothing happens, open the file manually: `~/.gtt/config.yml` - on Windows: `C:\Users\YourUserName\.gtt\config.yml` - -**Edit/create a local configuration file `.gtt.yml` in the current working directory:** - -```shell -gtt config --local -``` - -If a local configuration file is present it will extend of the global one and overwrites global settings. -If you don't want to extend the global configuration file, set the `extend` option in your local config to `false`. -So you can use gtt easily on a per project basis. Make sure to add .gtt.yml to your gitignore file if using a local configuration. - -### II) time tracking - -Time tracking enables you to monitor the time you spent on an issue or merge request locally. -When you're done, you can sync these time records to GitLab: gtt adds the time spent to the given -issue or merge request and automagically keeps everything in sync with your local data. - -Did you forgot to stop time monitoring locally and accidentally synced it to GitLab? -No worries, just edit the local record and run sync again. - -**Start local time monitoring for the given project and issue id:** - -```shell -gtt start "kriskbx/example-project" 15 -gtt start 15 -``` - -If you configured a project in your config you can omit the project. - -**Start local time monitoring for a merge request:** - -```shell -gtt start --type=merge_request "kriskbx/example-project" 15 -gtt start --type=merge_request 15 -``` - -**Start local time monitoring and create a new issue or merge request with the given title:** - -```shell -gtt create "kriskbx/example-project" "New Issue" -gtt create "New Issue" -gtt create --type=merge_request "kriskbx/example-project" "New Issue" -gtt create --type=merge_request "New Issue" -``` - -**Show the current time monitoring status:** - -```shell -gtt status -``` - -**Stop local time monitoring and save as a new time record:** - -```shell -gtt stop -``` - -**Cancel local time monitoring and discard the time record:** - -```shell -gtt cancel -``` - -**Show a list of all local time records (including their ids and meta data):** - -```shell -gtt log -``` -Note: gtt log uses UTC as default timezone. If you want to display the times in a different timezone, make sure to use `timezone: "Europe/Berlin"` in your config. - -**Edit a local time record by the given id:** - -```shell -gtt edit 2XZkV5LNM -gtt edit -``` - -You can omit the id to edit the last added time record. - -**Delete a local time record by the given id:** - -```shell -gtt delete 2XZkV5LNM -gtt delete -``` - -You can omit the id to delete the last added time record. - -**Sync local time records with time tracking data on Gitlab:** - -```shell -gtt sync -gtt sync --proxy="http://localhost:8888" -``` - -You can pass an url to the proxy option if you want to use a proxy server. - -### III) reports - -Get a report for the time tracking data stored on GitLab. If you want to include your local data make sure to sync it -before running the report command. The report command has a lot of options to filter data and output, make sure to -read through the docs before using it. - -#### Get a report - -```shell -gtt report ["namespace/project"] [issue_id] -gtt report "kriskbx/example-project" -gtt report "kriskbx/example-project" 145 -gtt report "kriskbx/example-project" 145 209 45 54 -gtt report -gtt report 145 -gtt report 123 345 123 -``` - -If you configured a project in your config file you can omit it. By passing a or multiple ids you can limit the -report to the given issues or merge requests. *Note: if you're passing a or multiple ids, gtt will fetch issues -with these ids by default. If you want to fetch merge requests you can change the query type using the -`--query` option.* - -#### Query groups and subgroups - -```shell -gtt report ["namespace"] --type=group -gtt report example-group --type=group -gtt report example-group --type=group --subgroups -``` - -Query all projects from the given group and combine the data into a single report. The option `--subgroups` -includes subgroups. - -#### Query multiple projects or groups and combine the data in one report - -```shell -gtt report ["namespace/project"] ["namespace/project"] ... -gtt report "kriskbx/example-project" "kriskbx/example-project-2" -gtt report ["namespace"] ["namespace"] ... --type=group -gtt report example-group example-group-2 --type=group -``` - -*Hint: use the `project_id` or `project_namespace` columns in your report.* - -#### Choose an output for your report - -```shell -gtt report --output=table -gtt report --output=markdown -gtt report --output=csv -gtt report --output=pdf --file=filename.pdf -gtt report --output=xlsx --file=filename.xlsx -``` - -Defaults to `table`. `csv` and `markdown` can be printed to stdout, `pdf` and `xlsx` need the file parameter. - -#### Print the output to a file - -```shell -gtt report --file=filename.txt -``` - -#### Only get time records from the given time frame - -```shell -gtt report --from="2017-03-01" --to="2017-04-01" -``` - -*Note: `--from` defaults to 1970-01-01, `--to` defaults to now. Make sure to use an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) compatible time/date format.* - -There are some quick shorthands: - -```shell -gtt report --today -gtt report --this_week -gtt report --this_month -``` - -#### Include closed issues/merge requests - -```shell -gtt report --closed -``` - -#### Limit to the given user - -```shell -gtt report --user=username -``` - -#### Limit to the given milestone - -```shell -gtt report --milestone=milestone_name -``` - -#### Limit issues and merge requests to the given labels - -```shell -gtt report --include_by_labels=critical --include_by_labels=important -``` - -#### Exclude issues and merge requests that have the given labels - -```shell -gtt report --exclude_by_labels=wont-fix --exclude_by_labels=ignore -``` - -#### Limit the query to the given data type - -```shell -gtt report --query=issues -gtt report --query=merge_requests -``` - -#### Include issues and merge requests in the report that have no time records - -```shell -gtt report --show_without_times -``` - -#### Limit the parts in the final report - -```shell -gtt report --report=stats --report=issues -``` - -*Note: These parts are available: `stats`, `issues`, `merge_requests`, `records`* - -#### Hide headlines in the report - -```shell -gtt report --no_headlines -``` - -#### Hide warnings in the report - -```shell -gtt report --no_warnings -``` - -#### Set date format for the report - -```shell -gtt report --date_format="DD.MM.YYYY HH:mm:ss" -``` - -*Note: [Click here](http://momentjs.com/docs/#/displaying/format/) for a further documentation on the date format.* - -#### Set time format for the report - -```shell -gtt report --time_format="[%sign][%days>d ][%hours>h ][%minutes>m ][%seconds>s]" -``` - -*Note: [Click here](#time-format) for a further documentation on the time format.* - -#### Set hours per day - -```shell -gtt report --hours_per_day=6 -``` - -#### Set columns included in the time record table - -```shell -gtt report --record_columns=user --record_columns=date --record_columns=time -``` - -*Note: Available columns to choose from: `user`, `date`, `type`, `iid`, `project_id`, `project_namespace`, `time`* - -#### Set columns included in the issue table - -```shell -gtt report --issue_columns=iid --issue_columns=title --issue_columns=time_username -``` - -*Note: Available columns to choose from: `id`, `iid`, `title`, `project_id`, -`project_namespace`, `description`, `labels`, `milestone`, `assignee`, `author`, -`closed`, `updated_at`, `created_at`, `due_date`, `state`, `spent`, `total_spent`, `total_estimate`* - -*You can also include columns that show the total time spent by a specific user -by following this convention: `time_username`* - -#### Set columns included in the merge request table - -```shell -gtt report --merge_request_columns=iid --merge_request_columns=title --merge_request_columns=time_username -``` - -*Note: Available columns to choose from: `id`, `iid`, `title`, `project_id`, -`project_namespace`, `description`, `labels`, `milestone`, `assignee`, `author`, -`updated_at`, `created_at`, `state`, `spent`, `total_spent`, `total_estimate`* - -*You can also include columns that show the total time spent by a specific user -by following this convention: `time_username`* - -#### Add columns for each project member to issue and merge request table, including their total time spent - -```shell -gtt report --user_columns -``` - -#### Only include the given labels in the report - -```shell -gtt report --include_labels=pending --include_labels=approved -``` - -#### Exclude the given labels from the report - -```shell -gtt report --exclude_labels=bug --exclude_labels=feature -``` - -#### Use a proxy server - -```shell -gtt report --proxy="http://localhost:8080" -``` - -#### Output verbose debug information - -```shell -gtt report --verbose -``` - -## configuration - -The configuration uses the [yaml file format](http://www.yaml.org/spec/1.2/spec.html). -[Click here](#i-configuration) for more information how to edit and create a config file. - -### Config File - -Here's a sample configuration file including all available options: - -```yaml -# Url to the gitlab api -# Make sure there's a trailing slash -# [required] -url: http://gitlab.com/api/v4/ - -# GitLab personal api token -# [required] -token: abcdefghijklmnopqrst - -# Use a proxy server -# defaults to false -proxy: http://localhost:8080 - -# Don't check SSL certificate -# defaults to false -insecure: true - -# Project -# defaults to false -project: namespace/projectname - -# Include closed issues and merge requests -# defaults to false -closed: true - -# Limit to the given milestone -# defaults to false -milestone: milestone_name - -# Exclude issues and merge requests that have the given labels -# defaults to an empty array -excludeByLabels: -- wont-fix -- ignore - -# Limit issues and merge requests to the given labels -# defaults to an empty array -includeByLabels: -- critical -- important - -# Limit the query to the given data type -# available: issues, merge_requests -# defaults to [issues, merge_requests] -query: -- issues - -# Limit the parts in the final report -# available: stats, issues, merge_requests, records -# defaults to [stats, issues, merge_requests, records] -report: -- stats -- records - -# Hide headlines in the report -# defaults to false -noHeadlines: true - -# Hide warnings in the report -# defaults to false -noWarnings: true - -# Include issues and merge requests in the report that have no time records -# defaults to false -showWithoutTimes: true - -# Hours per day -# defaults to 8 -hoursPerDay: 8 - -# Days per week -# defaults to 5 -daysPerWeek: 5 - -# Weeks per month -# defaults to 4 -weeksPerMonth: 4 - -# Include the given columns in the issue table -# See --issue_columns option for more information -# defaults to iid, title, spent, total_estimate -issueColumns: -- iid -- title -- total_estimate - -# Include the given columns in the merge request table -# See --merge_request_columns option for more information -# defaults to iid, title, spent, total_estimate -mergeRequestColumns: -- iid -- title -- total_estimate - -# Include the given columns in the time record table -# See --record_columns option for more information -# defaults to user, date, type, iid, time -recordColumns: -- user -- iid -- time - -# Add columns for each project member to issue and -# merge request table, including their total time spent -# defaults to true -userColumns: true - -# Date format -# Click here for format options: http://momentjs.com/docs/#/displaying/format/ -# defaults to DD.MM.YYYY HH:mm:ss -dateFormat: DD.MM.YYYY HH:mm:ss - -# Time format -# See time format configuration below -# defaults to "[%sign][%days>d ][%hours>h ][%minutes>m ][%seconds>s]" -timeFormat: "[%sign][%days>d ][%hours>h ][%minutes>m ][%seconds>s]" - -# Time format for different parts of the report -# Instead of specifying one global time format you can specify one for every -# part of the report and the log command -timeFormat: - log: "[%sign][%hours_overall]" - stats: "[%sign][%days_overall]" - issues: "[%sign][%hours_overall]" - merge_requests: "[%sign][%hours_overall]" - records: "[%sign][%days>d ][%hours>h ][%minutes>m ][%seconds>s]" - -# Change your timezone -# default: UTC -timezone: "Europe/Berlin" - -# Output type -# Available: csv, table, markdown, pdf, xlsx -# defaults to table -output: markdown - -# Exclude the given labels from the report -# defaults to an empty array -excludeLabels: -- bug -- feature - -# Only include the given labels in the report -# defaults to an empty array -includeLabels: -- pending -- approved - -# Only works if using a local configuration file! -# Extend the global configuration if set to true, pass a string to extend -# the configuration file stored at the given path -# defaults to true -extend: true - -# Change number of concurrent connections/http queries -# Note: Handle with care, we don't want to spam GitLabs API too much -# defaults to 10 -_parallel: 20 - -# Change rows per page (max. 100) -# defaults to 100 -_perPage: 100 - -# Verbose output -_verbose: false - -# Check access token validity up front -_checkToken: false - -# Skip parsing the issue/merge_request description for time records -_skipDescriptionParsing: false -``` - -### Time format - -##### `[%sign]`, `[%days]`, `[%hours]`, `[%minutes]`, `[%seconds]` - -Prints out the raw data. - -**Example config:** - -```yaml -timeFormat: "[%sign][%days]d [%hours]h [%minutes]m [%seconds]s" -``` - -**Example outputs:** - -```shell -0d 0h 30m 15s --1d 10h 15m 0s -``` - -##### `[%days>string]`, `[%hours>string]`, `[%minutes>string]`, `[%seconds>string]` - -This is a conditional: it prints out the raw data and appends the given string if the -data is greater than zero. - -**Example config:** - -```yaml -timeFormat: "[%sign][%days>d ][%hours>h ][%minutes>m ][%seconds>s]" -``` - -**Example outputs:** - -```shell -30m 15s --1d 10h 15m -``` - -##### `[%Days]`, `[%Hours]`, `[%Minutes]`, `[%Seconds]`, `[%Days>string]`, `[%Hours>string]`, `[%Minutes>string]`, `[%Seconds>string]` - -First letter uppercase adds leading zeros. - -**Example config:** - -```yaml -timeFormat: "[%sign][%Days]:[%Hours]:[%Minutes]:[%Seconds]" -``` - -**Example outputs:** - -```shell -00:00:30:15 --01:10:15:00 -``` - -##### `[%days_overall]`, `[%hours_overall]`, `[%minutes_overall]`, `[%seconds_overall]` - -Instead of printing out the second-, minute-, hour-, day-part of the duration this -prints the complete time in either seconds, minutes, hours or days. - -**Example config:** - -```yaml -timeFormat: "[%sign][%minutes_overall]" -``` - -**Example outputs:** - -```shell -30.25 -1095 -``` - -##### `[%days_overall_comma]`, `[%hours_overall_comma]`, `[%minutes_overall_comma]`, `[%seconds_overall_comma]` - -Use a comma for float values instead of a point. (Useful for some european countries) - -**Example config:** - -```yaml -timeFormat: "[%sign][%minutes_overall]" -``` - -**Example outputs:** - -```shell -30,25 -1095 -``` - -##### `[%hours_overall:2]`, `[%days_overall:3]` - -You can ceil any float value by adding the number of decimals to keep separated with a `:`. - -**Example config:** - -```yaml -timeFormat: "[%sign][%hours_overall:2]" -``` - -**Example outputs:** - -```shell -0,51 -18,25 -``` - -## how to use gtt as a library - -Add as a dependency using yarn: - -```shell -yarn add gitlab-time-tracker -``` - -... or using npm: - -```shell -npm install --save gitlab-time-tracker -``` - -Use it in your project: - -```js -// require modules -const Config = require('gitlab-time-tracker/src/include/config'); -const Report = require('gitlab-time-tracker/src/models/report'); - -// create a default config -let config = new Config(); - -// set required parameters -config.set('token', 'abcdefghijklmnopqrst'); -config.set('project', 'namespace/project'); - -// create report -let report = new Report(config); - -// query and process data -try { - await report.getProject() - await report.getIssues() - await report.getMergeRequests() - await report.processIssues() - await report.processMergeRequests() -} catch (error) { - console.log(error) -} - -// access data on report -report.issues.forEach(issue => { - // time records on issue - console.log(issue.times); - // time spent of single time record - console.log(issue.times[0].time); -}); -report.mergeRequests.forEach(mergeRequest => { - // time records on merge requests - console.log(mergeRequest.times); - // user of single time record - console.log(mergeRequest.times[0].user); -}); -``` - -## dumps - -Starting with 1.7.4 gtt can dump the results of all API requests within a report and use it on another machine without access to the GitLab instance itself. This is very useful for debugging purposes. If you stumble upon a bug which could be unique to your set of data, please rerun the report with these options to save a dump to the given file: `--output=dump --file=/path/dump.json` Check your dump for sensitive information and provide it when asked. - -## faqs - -#### What is the difference between 'total spent' and 'spent'? - -`total spent` is the total amount of time spent in all issues after filtering. -It can include times outside the queried time frame. `spent` on the other hand -is the total amount of time spent in the given time frame. - -## contributing - -I would love to integrate unit testing in this project, but unfortunately my knowledge of -testing in the JavaScript/Node.js world is very limited. (I'm actually a PHP dev) -So this would be a very helpful thing to contribute but of course all contributions are very welcome. - -* Please work in your own branch, e.g. `integrate-awesome-feature`, `fix-awful-bug`, `improve-this-crappy-docs` -* Create a pull request to the `dev` branch - -## support further development - -gtt is an open source project, developed and maintained completely in my free time. - -If you enjoy using gtt you can support the project by [contributing](#contributing) to the code base, -sharing it to your colleagues and co-workers or monetarily by [donating via PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DN9YVDKFGC6V6). -Every type of support is helpful and thank you very much if you consider supporting the project -or already have done so. 💜 - -## license - -GPL v2 diff --git a/file.odt b/file.odt new file mode 100644 index 0000000..6588544 Binary files /dev/null and b/file.odt differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..170d4c2 --- /dev/null +++ b/index.html @@ -0,0 +1 @@ +helloooo diff --git a/package.json b/package.json deleted file mode 100755 index 9496a9c..0000000 --- a/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "gitlab-time-tracker", - "version": "1.7.39", - "description": "A command line interface for GitLabs time tracking feature.", - "bugs": { - "url": "https://github.com/kriskbx/gitlab-time-tracker/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/kriskbx/gitlab-time-tracker.git" - }, - "main": "src/gtt.js", - "scripts": { - "test": "NODE_ENV=test mocha 'spec/**/*.spec.js'", - "cover": "istanbul cover _mocha $(find ./spec -name \"*.spec.js\")", - "coveralls": "yarn run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls", - "build": "pkg src/gtt.js -o out/gtt -c package.json" - }, - "bin": { - "gtt": "src/gtt.js" - }, - "engines": { - "node": ">=6.11" - }, - "pkg": { - "scripts": "src/**/*.js", - "targets": [ - "node10-linux-x64", - "node10-macos-x64", - "node10-win-x64" - ] - }, - "author": "kriskbx", - "license": "GPL-2.0", - "dependencies": { - "app-module-path": "^2.2.0", - "async": "^2.6.1", - "camelcase": "^4.1.0", - "cli-cursor": "^2.1.0", - "cli-table": "^0.3.1", - "colors": "^1.3.1", - "commander": "kriskbx/commander.js", - "csv-string": "^2.3.2", - "find-in-files": "^0.4.0", - "hash-sum": "^1.0.2", - "hashids": "^1.1.1", - "markdown-pdf": "^9.0.0", - "markdown-table": "^1.1.0", - "moment": "^2.22.2", - "moment-timezone": "^0.5.21", - "node-spinner": "^0.0.4", - "open": "^0.0.5", - "progress": "^2.0.0", - "prompt": "^1.0.0", - "read-yaml": "^1.1.0", - "request": "^2.87.0", - "request-promise-native": "^1.0.4", - "shelljs": "^0.8.3", - "tempfile": "^2.0.0", - "throttled-queue": "^1.0.7", - "underscore": "^1.9.1", - "xdg-basedir": "^3.0.0", - "xlsx": "^0.13.5" - }, - "devDependencies": { - "chai": "^4.1.2", - "coveralls": "^2.13.1", - "istanbul": "^0.4.5", - "mocha": "^5", - "mocha-lcov-reporter": "^1.3.0", - "pkg": "^4.3.4", - "sinon": "^3.2.1" - } -} diff --git a/preview/demo.gif b/preview/demo.gif deleted file mode 100644 index 6904fa1..0000000 Binary files a/preview/demo.gif and /dev/null differ diff --git a/preview/icon.gvdesign b/preview/icon.gvdesign deleted file mode 100644 index 56a1d79..0000000 Binary files a/preview/icon.gvdesign and /dev/null differ diff --git a/preview/icon.png b/preview/icon.png deleted file mode 100755 index d4bfe03..0000000 Binary files a/preview/icon.png and /dev/null differ diff --git a/readme.md b/readme.md deleted file mode 100755 index bc99b29..0000000 --- a/readme.md +++ /dev/null @@ -1,31 +0,0 @@ -![gtt](https://raw.githubusercontent.com/kriskbx/gitlab-time-tracker/master/preview/icon.png) - -

- - - - - -

- -## ⚠️ Attention - -This repository is not maintained anymore. If you still want to use gtt and get regular updates, I recommend checking out this fork: https://github.com/ndu2/gitlab-time-tracker - -## introduction - -gtt is a fully featured command line interface for GitLab's time tracking feature. It monitors the time you spent on an issue or merge request locally and syncs it to GitLab. It also allows you to create reports in various formats from time tracking data stored on GitLab. **Looking for a graphical user interface? Check out the [gtt taskbar/menubar app](https://github.com/kriskbx/gitlab-time-tracker-taskbar) for Linux, Mac & Windows!** - -![gtt demo](https://raw.githubusercontent.com/kriskbx/gitlab-time-tracker/master/preview/demo.gif) - -## documentation - -How to install and use gtt? You can find the documentation [here](https://github.com/kriskbx/gitlab-time-tracker/blob/master/documentation.md). - -## support further development - -Please support the development of this free software by [donating or sharing](https://github.com/kriskbx/gitlab-time-tracker/blob/master/documentation.md#support-further-development)! - -## license - -gtt is open-source software licensed under the [GPL V2 license](https://github.com/kriskbx/gitlab-time-tracker/blob/master/LICENSE). diff --git a/spec/_setup.spec.js b/spec/_setup.spec.js deleted file mode 100755 index e676c17..0000000 --- a/spec/_setup.spec.js +++ /dev/null @@ -1,10 +0,0 @@ -const sinon = require('sinon'); -const chai = require('chai'); - -beforeEach(function () { - this.sandbox = sinon.sandbox.create() -}); - -afterEach(function () { - this.sandbox.restore() -}); \ No newline at end of file diff --git a/spec/include/config.spec.js b/spec/include/config.spec.js deleted file mode 100755 index 41cf003..0000000 --- a/spec/include/config.spec.js +++ /dev/null @@ -1,77 +0,0 @@ -const config = require('./../../src/include/config'); -const expect = require('chai').expect; - -describe('The config class', () => { - it('stores data', () => { - let Config = new config(), - data = 'value_' + Math.random(), - key = 'key_' + Math.random(); - - Config.set(key, data); - - expect(Config.get(key)).to.equal(data); - }); - - it('doesnt store data if the value is null or undefined until you force it', () => { - let Config = new config(), - data = 'value_' + Math.random(), - key = 'key_' + Math.random(); - - Config.set(key, data); - - Config.set(key, null); - expect(Config.get(key)).to.equal(data); - - Config.set(key, undefined); - expect(Config.get(key)).to.equal(data); - - Config.set(key, null, true); - expect(Config.get(key)).to.equal(null); - - Config.set(key, undefined, true); - expect(Config.get(key)).to.equal(undefined); - }); - - it('returns moment instances for dates', () => { - let Config = new config(), - dates = ['from', 'to']; - - dates.forEach(date => { - Config.set(date, "2017-08-01"); - expect(typeof Config.get(date).format).to.equal("function"); - }); - }); - - it('returns values from objects and falls back to the default', () => { - let Config = new config(), - objectsWithDefaults = ['timeFormat'], - defaults = Object.assign({}, Config.data), - stringData = 'booze', - objectData = { - foo: 'bar', - baz: 'bar' - }; - - objectsWithDefaults.forEach(key => { - Config.set(key, objectData); - - expect(Config.get(key, 'foo')).to.equal('bar'); - expect(Config.get(key, 'baz')).to.equal('bar'); - expect(Config.get(key, 'not_a_real_key')).to.equal(defaults[key]); - - Config.set(key, stringData); - - expect(Config.get(key, 'foo')).to.equal('booze'); - expect(Config.get(key, 'baz')).to.equal('booze'); - expect(Config.get(key, 'not_a_real_key')).to.equal('booze'); - }); - }); - - it('makes durations human readable', () => { - let Config = new config(), - humanReadable = "1d 4h 30m 10s", - seconds = 45010; - - expect(Config.toHumanReadable(seconds)).to.equal(humanReadable); - }); -}); \ No newline at end of file diff --git a/spec/include/file-config.spec.js b/spec/include/file-config.spec.js deleted file mode 100755 index 96f919f..0000000 --- a/spec/include/file-config.spec.js +++ /dev/null @@ -1,3 +0,0 @@ -describe('The file config class', () => { - -}); \ No newline at end of file diff --git a/src/gtt-cancel.js b/src/gtt-cancel.js deleted file mode 100755 index 738471a..0000000 --- a/src/gtt-cancel.js +++ /dev/null @@ -1,27 +0,0 @@ -const program = require('commander'); -const colors = require('colors'); -const moment = require('moment'); - -const Config = require('./include/file-config'); -const Cli = require('./include/cli'); -const Tasks = require('./include/tasks'); - -program - .option('--verbose', 'show verbose output') - .parse(process.argv); - -Cli.verbose = program.verbose; - -let config = new Config(process.cwd()); -let tasks = new Tasks(config); - -tasks.cancel() - .then(frames => { - frames.forEach(frame => { - if(!frame.resource.new) - return console.log(`Cancel project ${frame.project.magenta} ${frame.resource.type.blue} ${('#' + frame.resource.id).blue}, started ${moment(frame.start).fromNow().green}`) - - console.log(`Cancel project ${frame.project.magenta} for new ${frame.resource.type} "${(frame.resource.id).blue}", started ${moment(frame.start).fromNow().green}`) - }) - }) - .catch(error => Cli.error(error)); \ No newline at end of file diff --git a/src/gtt-config.js b/src/gtt-config.js deleted file mode 100755 index db5d245..0000000 --- a/src/gtt-config.js +++ /dev/null @@ -1,16 +0,0 @@ -const program = require('commander'); - -const Config = require('./include/file-config'); -const Fs = require('./include/filesystem'); - -let config = new Config(process.cwd()); - -program - .option('-l, --local', 'edit the local configuration file') - .parse(process.argv); - -if (program.local) { - config.assertLocalConfig(); -} - -Fs.open(program.local ? config.local : config.global); \ No newline at end of file diff --git a/src/gtt-create.js b/src/gtt-create.js deleted file mode 100755 index 20adec0..0000000 --- a/src/gtt-create.js +++ /dev/null @@ -1,31 +0,0 @@ -const colors = require('colors'); -const moment = require('moment'); -const program = require('commander'); - -const Config = require('./include/file-config'); -const Cli = require('./include/cli'); -const Tasks = require('./include/tasks'); - -program - .arguments('[project] [title]') - .option('-t, --type ', 'specify resource type: issue, merge_request') - .option('--verbose', 'show verbose output') - .parse(process.argv); - -Cli.verbose = program.verbose; - -let config = new Config(process.cwd()), - tasks = new Tasks(config), - type = program.type ? program.type : 'issue', - title = program.args.length === 1 ? program.args[0] : program.args[1], - project = program.args.length === 2 ? program.args[0] : null; - -if (program.args.length < 2 && !config.get('project')) - Cli.error('No project set'); - -if (!title) - Cli.error('Wrong or missing title'); - -tasks.start(project, type, title) - .then(frame => console.log(`Starting project ${config.get('project').magenta} and create ${type} "${title.blue}" at ${moment().format('HH:mm').green}`)) - .catch(error => Cli.error(error)); \ No newline at end of file diff --git a/src/gtt-delete.js b/src/gtt-delete.js deleted file mode 100755 index c9937fe..0000000 --- a/src/gtt-delete.js +++ /dev/null @@ -1,24 +0,0 @@ -const program = require('commander'); - -const Frame = require('./models/frame'); -const Config = require('./include/file-config'); -const Cli = require('./include/cli'); -const Fs = require('./include/filesystem'); - -program - .arguments('[id]') - .parse(process.argv); - -let config = new Config(process.cwd()); -let id = program.args[0]; - -if ( - (!id || !Fs.exists(Fs.join(config.frameDir, id + '.json'))) - && -Infinity === (id = Fs.newest(config.frameDir)) -) - Cli.error('No record found.'); - -let file = Fs.join(config.frameDir, id.replace('.json', '') + '.json'); -let frame = Frame.fromFile(config, file).stopMe(); -Fs.remove(file); -console.log(`Deleting record ${frame.id.magenta}`); \ No newline at end of file diff --git a/src/gtt-edit.js b/src/gtt-edit.js deleted file mode 100755 index cdd1524..0000000 --- a/src/gtt-edit.js +++ /dev/null @@ -1,20 +0,0 @@ -const program = require('commander'); - -const Config = require('./include/file-config'); -const Cli = require('./include/cli'); -const Fs = require('./include/filesystem'); - -program - .arguments('[id]') - .parse(process.argv); - -let config = new Config(process.cwd()); -let id = program.args[0]; - -if ( - (!id || !Fs.exists(Fs.join(config.frameDir, id + '.json'))) - && -Infinity === (id = Fs.newest(config.frameDir)) -) - Cli.error('No record found.'); - -Fs.open(Fs.join(config.frameDir, id.replace('.json', '') + '.json')); \ No newline at end of file diff --git a/src/gtt-log.js b/src/gtt-log.js deleted file mode 100755 index 7dd85d8..0000000 --- a/src/gtt-log.js +++ /dev/null @@ -1,42 +0,0 @@ -const _ = require('underscore'); -const program = require('commander'); -const colors = require('colors'); -const moment = require('moment-timezone'); - -const Config = require('./include/file-config'); -const Cli = require('./include/cli'); -const Time = require('./models/time'); -const Tasks = require('./include/tasks'); - -program - .option('--verbose', 'show verbose output') - .option('--hours_per_day ', 'hours per day for human readable time formats') - .option('--time_format ', 'time format') - .parse(process.argv); - -Cli.verbose = program.verbose; - -let config = new Config(__dirname).set('hoursPerDay', program.hours_per_day), - tasks = new Tasks(config), - timeFormat = config.set('timeFormat', program.time_format).get('timeFormat', 'log'); - -function toHumanReadable(input) { - return Time.toHumanReadable(Math.ceil(input), config.get('hoursPerDay'), timeFormat); -} - -tasks.log() - .then(({frames, times}) => { - Object.keys(frames).sort().forEach(date => { - if (!frames.hasOwnProperty(date)) return; - - console.log(`${moment(date).format('MMMM Do YYYY')} (${toHumanReadable(times[date])})`.green); - frames[date] - .sort((a, b) => a.start.isBefore(b.start) ? -1 : 1) - .forEach(frame => { - let issue = frame.resource.new ? `new ${frame.resource.type + ' "' + frame.resource.id.blue}"` : `${(frame.resource.type + ' #' + frame.resource.id).blue}`; - console.log(` ${frame.id} ${frame.start.clone().format('HH:mm').green} to ${frame.stop.clone().format('HH:mm').green}\t${toHumanReadable(frame.duration)}\t\t${frame.project.magenta}\t\t${issue}`) - }); - }); - } - ) - .catch(error => Cli.error(error)); \ No newline at end of file diff --git a/src/gtt-report.js b/src/gtt-report.js deleted file mode 100755 index fac46da..0000000 --- a/src/gtt-report.js +++ /dev/null @@ -1,355 +0,0 @@ -const _ = require('underscore'); -const fs = require('fs'); -const program = require('commander'); -const moment = require('moment'); - -const Cli = require('./include/cli'); -const Config = require('./include/file-config'); -const Report = require('./models/report'); -const Owner = require('./models/owner'); -const ReportCollection = require('./models/reportCollection'); - -const Output = { - table: require('./output/table'), - csv: require('./output/csv'), - pdf: require('./output/pdf'), - markdown: require('./output/markdown'), - dump: require('./output/dump'), - xlsx: require('./output/xlsx') -}; - -// this collects options -function collect(val, arr) { - if (!arr) arr = []; - arr.push(val); - - return _.uniq(arr); -} - -// set options -program - .arguments('[project] [ids]') - .option('-e --type ', 'specify the query type: project, user, group') - .option('--subgroups', 'include sub groups') - .option('--url ', 'URL to GitLabs API') - .option('--token ', 'API access token') - .option('-p --proxy ', 'use a proxy server with the given url') - .option('--insecure', 'don\'t check certificates') - .option('-f --from ', 'query times that are equal or greater than the given date') - .option('-t --to ', 'query times that are equal or smaller than the given date') - .option('--today', 'ignores --from and --to and queries entries for today') - .option('--this_week', 'ignores --from and --to and queries entries for this week') - .option('--this_month', 'ignores --from and --to and queries entries for this month') - .option('-c --closed', 'include closed issues') - .option('-m --milestone ', 'include issues from the given milestone') - .option('--hours_per_day ', 'hours per day for human readable time formats') - .option('-u --user ', 'only query times from the given user') - .option('-q --query ', 'query the given data types: issues, merge_requests', collect, null) - .option('-r --report ', 'include in the report: stats, issues, merge_requests, records', collect, null) - .option('-o --output ', 'use the given output') - .option('-l --file ', 'save report to the given file') - .option('--include_by_labels ', 'only include issues that have the given labels', collect, null) - .option('--exclude_by_labels ', 'exclude issues that have the given labels', collect, null) - .option('--include_labels ', 'only include the given labels in the report', collect, null) - .option('--exclude_labels ', 'exclude the given labels in the report', collect, null) - .option('--date_format ', 'use the given date format in the report', collect, null) - .option('--time_format