Skip to content

Commit

Permalink
Document how we obtain the name of the cabal config file.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasabel committed Jan 13, 2024
1 parent b1dc5f1 commit fcc14da
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions lib/setup-haskell.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/setup-haskell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ async function cabalConfig(): Promise<string> {
silent: true,
listeners: {stdout: append, stderr: append}
});
// The last line of the cabal help text is printing the config file, e.g.:
//
// > You can edit the cabal configuration file to set defaults:
// > <<HOME>>/.cabal/config
//
// So trimming the last line will give us the name of the config file.
//
// Needless to say this is very brittle, but we secure this by a test
// in Cabal's testsuite.
return out.toString().trim().split('\n').slice(-1)[0].trim();
}

Expand Down

0 comments on commit fcc14da

Please sign in to comment.