Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • new package dirtree available on SSC

    Thanks to Kit Baum a new package, dirtree, is now available on SSC. dirtree shows the content of a directory, including sub-directories, as a tree. By default, files that can be opened in Stata are shown as clickable links.

    For example, the directory for this project looks like this (the bench directory contains various dummy files and directories that are there for testing):

    Code:
    . dirtree, nolink
    dirtree \
    ├── dirtree.ado
    ├── dirtree.pkg
    ├── dirtree.sthlp
    ├── readme.md
    ├── stata.toc
    └── bench \
        ├── dirtree.do
        ├── main.do
        ├── subroutine.do
        ├── totest.smcl
        ├── bar \
        └── foo \
            ├── untitled1.do
            ├── blup \
            │   └── untitled2.do
            └── something
    To install it you can type in Stata ssc install dirtree . Alternatively, you can go to https://github.com/maartenteaches/dirtree if you also want to look at the certification scripts (directory bench).
    Last edited by Maarten Buis; 19 Jun 2023, 02:43.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

  • #2
    Thanks to Kit Baum a new version of dirtree is now available on SSC. The main change is that I used a different way to draw the lines that look nicer and makes sure that the hit box for the link to files that can be opened in Stata aligns with the name of that file. The package can be installed by typing in Stata ssc install dirtree, replace
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Thanks to Kit Baum a new version of dirtree is now available on SSC. This version adds the noexpand() option, where users can specify what folders they don't want to expand. The package can be installed by typing in Stata ssc install dirtree, replace

      The use case I have for the noexpand() option is that I want my project to contain an ado folder with all the community contributed packages I use for that project in them. In the main .do file I use sysdir set to make sure that during that project Stata will only look at the packages local to that project. That way I can just give a copy of my project folder to anyone, and they should be able to reproduce my findings exactly. However, when I want to take a look at my project folder with dirtree I usually don't want to see what is in that ado folder, so I type:

      Code:
      . dirtree , noexpand(ado)
      dummy \
      ├── readme.md
      ├── ado \
      │   └── ...
      ├── ana \
      │   ├── dummy01.dta
      │   ├── dummy_ana01.do
      │   ├── dummy_dta01.do
      │   ├── dummy_dta01.txt
      │   ├── dummy_dta02.do
      │   └── dummy_main.do
      ├── data \
      │   ├── cb.html
      │   └── dummy_v0-1-0.dta
      ├── docu \
      │   └── research_log.md
      └── txt \
      ---------------------------------
      Maarten L. Buis
      University of Konstanz
      Department of history and sociology
      box 40
      78457 Konstanz
      Germany
      http://www.maartenbuis.nl
      ---------------------------------

      Comment


      • #4
        Obviously, you're writing this stuff tailored to your needs, and rightfully so. However, if there was a wishlist for this, here is mine (in that order):

        1. A maxdepth() (or a better name) option for controlling the subdirectories' depth would be nice.
        2. I'd like to see click-able directories and sub-directories, so I can cd to the respective directory by clicking it.
        3. A way of storing the options to set my own defaults. Perhaps as a macro or even a setup file.
        4. I'd prefer the optionally specified directory to be implemented as the argument rather than an option. That is, instead of typing dirtree, dir(directory), I'd prefer dirtree directory; it seems more natural and direct to me, though, of course, that's subjective.

        Comment


        • #5
          Thanks to Kit Baum a new version of dirtree is now available on SSC. It implements daniel klein 's suggestions 1,2, and 4.
          ---------------------------------
          Maarten L. Buis
          University of Konstanz
          Department of history and sociology
          box 40
          78457 Konstanz
          Germany
          http://www.maartenbuis.nl
          ---------------------------------

          Comment


          • #6
            Yes, great! Thanks for this!

            Comment

            Working...
            X