From 49fbf68a55cb5ff92532aea3139d132006a34eb3 Mon Sep 17 00:00:00 2001 From: Miklos Koren Date: Fri, 31 Jul 2020 19:17:34 +0200 Subject: [PATCH] Stop at .git folder Resolves #2 --- here.ado | 9 +++++---- here.hlp | 10 +++++----- here.pkg | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/here.ado b/here.ado index a5be660..a607b29 100644 --- a/here.ado +++ b/here.ado @@ -1,6 +1,5 @@ program define here, rclass syntax [, nogit set] - * FIXME: implement .git tempname here @@ -15,7 +14,7 @@ program define here, rclass local `current' = c(pwd) * are we there yet? - are_we_there_yet + are_we_there_yet, `git' while (_rc) { * if at root folder without .here, stop with an error if ("`c(pwd)'" == "") { @@ -27,7 +26,7 @@ program define here, rclass if (_rc) { break_with_error, directory(``current'') } - are_we_there_yet + are_we_there_yet, `git' } local `here' = c(pwd) @@ -39,8 +38,10 @@ program define here, rclass end program define are_we_there_yet + syntax [, nogit] + capture confirm file ".here" - if (_rc != 0) { + if (_rc != 0) & ("`git'" != "nogit") { capture confirm file ".git" } end diff --git a/here.hlp b/here.hlp index 9a6ee29..e5c04e3 100644 --- a/here.hlp +++ b/here.hlp @@ -21,10 +21,10 @@ Type the command ^here^ anywhere inside a project folder and it will put the *ro /Users/koren/projects/social-distancing/analysis/counterfactual . here -/Users/koren/projects/social-distancing +/Users/koren/projects/social-distancing/ . display "${here}" -/Users/koren/projects/social-distancing +/Users/koren/projects/social-distancing/ . import delimited "${here}/data/raw/bls/employment.csv" @@ -34,10 +34,10 @@ To fix the root folder, use ^here, set^. /Users/koren/projects/social-distancing/analysis . here, set -/Users/koren/projects/social-distancing/analysis +/Users/koren/projects/social-distancing/analysis/ . display ${here} -/Users/koren/projects/social-distancing/analysis +/Users/koren/projects/social-distancing/analysis/ Under the hood -------------- @@ -69,4 +69,4 @@ Options ^set^ sets the root folder of the project. -^nogit^ ignores .git folders when finding the root folder. (Not implemented yet.) +^nogit^ ignores .git folders when finding the root folder. \ No newline at end of file diff --git a/here.pkg b/here.pkg index dadc759..560f762 100644 --- a/here.pkg +++ b/here.pkg @@ -6,6 +6,6 @@ d 'here' roughly implements the behavior of the CRAN library with the same name. d d Author: Miklós Koren d License: MIT -d Distribution-Date: 20200723 +d Distribution-Date: 20200731 f here.ado f here.hlp \ No newline at end of file