dgtools - argvparse - recover - repo - shistory
dgtools::repo - package and command line application for installation of Tcl packages directly from github and chiselapp repositories.
Usage as package:
package require tls package require json package require dgtools::repo namespace import ::dgtools::repo repo import github user repository folder repo import chiselapp user repository folder repo download github url folder repo download chiselapp url folder
Usage as command line application:
tclsh repo.tcl "https://chiselapp.com/user/dgroth/repository/tclcode/dir?ci=c50f458ca23f7ae5&name=dgw" dgw tclsh repo.tcl https://github.com/tcltk/tcllib/tree/master/modules/des des
dgtools::repo - is a package for directly downloading folders and packages from github and chiselapp repositories. It is useful if multiple packages are available within a certain repository and the user only likes to install one or a few of them. Further a command line interface is available to download only files from specific directories and their subdirectories from larger repositories.
There are three sub commands available: import and update should be used to retrieve Tcl packages and install them in a parallel directory to the actual script or the last directory given in auto_path. The command download downloads a specific subfolder of a directory into either the current directory or a given path.
dgtools::repo provider cmd user repo directory
Downloads and installs the given directory as a Tcl package in parallel to the actual script. As package name the last part of the directory name is used. The arguments are explained below:
- provider: either github or chiselapp currently only
- cmd: either
importwhich checks if the package was already downloaded and only if this is not not the case it installs it, or
updatewhich will redo the download and possibly overwrite the current package.
- user: the user id of the repository maintainer such as "tcltk" for example
- repo: the repository name such as "tcllib" for example
- directory: the relative folder within the repository such as "modules/snit" for example
dgtools::repo provider download url directory
Downloads a specific (sub)folder and all files and folders within from a repository of github or chiselapp.
- provider either github or chiselapp
- url the url which is visible in standard view mode of the repository in the webbrowser
- directory in which the repository folder should be stored locally
Below an example which install the snit package from tcllib and the dgw package from the chiselapp tclcode repository of dgroth.
package require dgtools::repo namespace import dgtool::repo repo github import tcltk tcllib modules/snit repo chiselapp import dgroth tclcode dgw package require snit package require dgw
Installation is easy, you can install and use the dgtools::repo package if you have a working install of:
For installation you copy the complete dgtools folder into a path of your auto_path list of Tcl or you append the auto_path list with the parent dir of the dgtools directory. Alternatively you can install the package as a Tcl module by creating a file dgtools/repo-0.1.tm in your Tcl module path. The latter in many cases can be achieved by using the --install option of repo.tcl. Try "tclsh repo.tcl --install" for this purpose in the terminal.
Example code for this package can be executed by running this file using the following command line:
$ tclsh repo.tcl --demo
The example code used for this demo can be seen in the terminal by using the following command line:
$ tclsh repo.tcl --code
The script contains embedded the documentation in Markdown format. To extract the documentation you should use the following command line:
$ tclsh repo.tcl --markdown
This will extract the embedded manual pages in standard Markdown format. You can as well use this markdown output directly to create html pages for the documentation by using the --html flag.
$ tclsh repo.tcl --html
This will directly create a HTML page
repo.html which contains the formatted documentation.
Github-Markdown can be extracted by using the --man switch:
The output of this command can be used to feed a markdown processor for conversion into a man page, a html or a pdf document. If you have pandoc installed for instance, you could execute the following commands:
# man page tclsh repo.tcl --man | pandoc -s -f markdown -t man - > repo.n # html page tclsh ../repo.tcl --man > repo.md pandoc -i repo.md -s -o repo.html # pdf pandoc -i repo.md -s -o repo.tex pdflatex repo.tex
The dgtools::repo package type was written by Detlef Groth, Schwielowsee, Germany.
package dgtools::repo, version 0.1.
Copyright (c) 2020 Dr. Detlef Groth, E-mail: detlef(at)dgroth(dot)de
This library is free software; you can use, modify, and redistribute it for any purpose, provided that existing copyright notices are retained in all copies and that this notice is included verbatim in any distributions.
This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.