Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions cli.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
resyntax
resyntax/base
resyntax/default-recommendations
resyntax/private/file-group
resyntax/grimoire/source-group
resyntax/private/github
resyntax/private/refactoring-result
resyntax/grimoire/source
Expand Down Expand Up @@ -71,25 +71,25 @@
("--file"
filepath
"A file to analyze."
(vector-builder-add targets (single-file-group filepath all-lines)))
(vector-builder-add targets (single-source-group filepath all-lines)))

("--directory"
dirpath
"A directory to analyze, including subdirectories."
(vector-builder-add targets (directory-file-group dirpath)))
(vector-builder-add targets (directory-source-group dirpath)))

("--package"
pkgname
"An installed package to analyze."
(vector-builder-add targets (package-file-group pkgname)))
(vector-builder-add targets (package-source-group pkgname)))

("--local-git-repository"
repopath baseref
"A Git repository to search for modified files to analyze. The repopath argument is a directory
path to the root of a Git repository, and the baseref argument is a Git reference (in the form \
\"remotename/branchname\") to use as the base state of the repository. Any files that have been \
changed relative to baseref are analyzed."
(vector-builder-add targets (git-repository-file-group repopath baseref)))
(vector-builder-add targets (git-repository-source-group repopath baseref)))

#:once-each

Expand Down Expand Up @@ -158,25 +158,25 @@ determined by the GITHUB_REPOSITORY and GITHUB_REF environment variables."

#:multi

("--file" filepath "A file to fix." (add-target! (single-file-group filepath all-lines)))
("--file" filepath "A file to fix." (add-target! (single-source-group filepath all-lines)))

("--directory"
dirpath
"A directory to fix, including subdirectories."
(add-target! (directory-file-group dirpath)))
(add-target! (directory-source-group dirpath)))

("--package"
pkgname
"An installed package to fix."
(add-target! (package-file-group pkgname)))
(add-target! (package-source-group pkgname)))

("--local-git-repository"
repopath baseref
"A Git repository to search for modified files to fix. The repopath argument is a directory
path to the root of a Git repository, and the baseref argument is a Git reference (in the form \
\"remotename/branchname\") to use as the base state of the repository. Any files that have been \
changed relative to baseref are analyzed and fixed."
(add-target! (git-repository-file-group repopath baseref)))
(add-target! (git-repository-source-group repopath baseref)))

#:once-each

Expand Down Expand Up @@ -284,7 +284,8 @@ For help on these, use 'analyze --help' or 'fix --help'."

(define (resyntax-analyze-run)
(define options (resyntax-analyze-parse-command-line))
(define sources (file-groups-resolve (resyntax-analyze-options-targets options)))
(define target-group (source-group-union-all (resyntax-analyze-options-targets options)))
(define sources (source-group-resolve target-group))
(define analysis
(resyntax-analyze-all sources
#:suite (resyntax-analyze-options-suite options)
Expand Down Expand Up @@ -329,7 +330,8 @@ For help on these, use 'analyze --help' or 'fix --help'."
(define options (resyntax-fix-parse-command-line))
(define fix-method (resyntax-fix-options-fix-method options))
(define output-format (resyntax-fix-options-output-format options))
(define sources (file-groups-resolve (resyntax-fix-options-targets options)))
(define target-group (source-group-union-all (resyntax-fix-options-targets options)))
(define sources (source-group-resolve target-group))
(define max-modified-files (resyntax-fix-options-max-modified-files options))
(define max-modified-lines (resyntax-fix-options-max-modified-lines options))
(define analysis
Expand Down
4 changes: 4 additions & 0 deletions cli.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ for fixing code by applying Resyntax's suggestions.
Note that at present, Resyntax is limited in what files it can fix. Resyntax only analyzes files with
the @exec{.rkt} extension where @tt{#lang racket/base} is the first line in the file.

Each of the target flags accepted by these commands constructs a @tech{source group} describing which
files to operate on. See @secref["source-group"] in The Resyntax Grimoire for the API underlying these
flags.


@section[#:tag "install"]{Installation}

Expand Down
1 change: 1 addition & 0 deletions grimoire.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ programmatically on anything found here.


@include-section[(lib "resyntax/grimoire/source.scrbl")]
@include-section[(lib "resyntax/grimoire/source-group.scrbl")]
@include-section[(lib "resyntax/grimoire/syntax-path.scrbl")]
Loading
Loading