Subject: [bug#71305] [PATCH 3/3] gnu: Add cf-tool.

From: Luis Higino <[email-masked]>
Date: Sat, 1 Jun 2024 05:06:33 +0000

* gnu/packages/web.scm (cf-tool): New variable.

Change-Id: Ib64cf9f26b3b1f3d761fa897365fce07822c3b11
---
 .../patches/cf-tool-add-languages.patch       | 22 +++++++
 gnu/packages/web.scm                          | 63 +++++++++++++++++++
 2 files changed, 85 insertions(+)
 create mode 100644 gnu/packages/patches/cf-tool-add-languages.patch

diff --git a/gnu/packages/patches/cf-tool-add-languages.patch b/gnu/packages/patches/cf-tool-add-languages.patch
new file mode 100644
index 0000000000..a5dc0c8cfa
--- /dev/null
+++ b/gnu/packages/patches/cf-tool-add-languages.patch
@@ -0,0 +1,22 @@
+Add newer language options.
+
+diff --git a/client/langs.go b/tmp/langs.go
+index b09c69f..0695958 100644
+--- a/client/langs.go
++++ b/tmp/langs.go
+@@ -9,6 +9,7 @@ var Langs = map[string]string{
+ 	"42": "GNU G++11 5.1.0",
+ 	"50": "GNU G++14 6.4.0",
+ 	"54": "GNU G++17 7.3.0",
++	"89": "GNU G++20 13.2 (64 bit, winlibs)",
+ 	"2":  "Microsoft Visual C++ 2010",
+ 	"59": "Microsoft Visual C++ 2017",
+ 	"9":  "C# Mono 5.18",
+@@ -60,6 +61,7 @@ var LangsExt = map[string]string{
+ 	"GNU C++11":             "cpp",
+ 	"GNU C++14":             "cpp",
+ 	"GNU C++17":             "cpp",
++	"GNU G++20":             "cpp",
+ 	"MS C++":                "cpp",
+ 	"MS C++ 2017":           "cpp",
+ 	"Mono C#":               "cs",
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index cbf270ec6b..8224522f4e 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -9314,6 +9314,69 @@ (define-public kiwix-tools
 @end itemize\n")
     (license license:gpl3+)))
 
+(define-public cf-tool
+  (package
+    (name "cf-tool")
+    (version "1.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/xalanq/cf-tool")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ad2mljjg4pr8jjk9i1asnld16xi1wdfnh25drngm3c590cmrnfj"))
+       (patches (search-patches "cf-tool-add-languages.patch"))
+       (modules '((guix build utils)))
+       ;; Remove assets and vendorized dependencies from checkout
+       (snippet '(begin
+                   (delete-file-recursively "assets")
+                   (delete-file-recursively "vendor")))))
+    (build-system go-build-system)
+    (inputs (list go-github-com-puerkitobio-goquery
+                  go-github-com-docopt-docopt-go
+                  go-github-com-fatih-color
+                  go-github-com-k0kubun-go-ansi
+                  go-github-com-mitchellh-go-homedir
+                  go-github-com-olekukonko-tablewriter
+                  go-github-com-sergi-go-diff
+                  go-github-com-skratchdot-open-golang
+                  go-golang-org-x-crypto
+                  go-golang-org-x-term
+                  go-github-com-shirou-gopsutil))
+    (arguments
+     (list
+      #:install-source? #f
+      #:go go-1.18
+      #:import-path "github.com/xalanq/cf-tool"
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'install 'add-alternate-name
+                     (lambda* _
+                       (let ((bin (string-append #$output "/bin")))
+                         (symlink (string-append bin "/cf-tool")
+                                  (string-append bin "/cf"))))))))
+    (home-page "https://github.com/xalanq/cf-tool")
+    (synopsis
+     "Command-line interface tool for @url{https://codeforces.com, Codeforces}")
+    (description
+     "Codeforces Tool is a command-line interface tool for
+@url{https://codeforces.com,Codeforces}.  Its features include:
+@itemize
+@item Support Contests, Gym, Groups and acmsguru.
+@item Support all programming languages in Codeforces.
+@item Submit codes.
+@item Watch submissions' status dynamically.
+@item Fetch problems' samples.
+@item Compile and test locally.
+@item Clone all codes of someone.
+@item Generate codes from the specified template (including timestamp, author, etc.)
+@item List problems' stats of one contest.
+@item Use default web browser to open problems' pages, standings' page, etc.
+@item Setup a network proxy.  Setup a mirror host.
+@end itemize")
+    (license license:expat)))
+
 (define-public uriparser
   (package
     (name "uriparser")
-- 
2.41.0