summaryrefslogtreecommitdiffstats
path: root/commands/commands.go
AgeCommit message (Collapse)Author
2023-05-17commands: Improve the common build flag handlingBjørn Erik Pedersen
Updates #10947
2023-05-17Re-establish all the server flagsBjørn Erik Pedersen
Updates #10947
2023-05-16Create a struct with all of Hugo's config optionsBjørn Erik Pedersen
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes #10896 Closes #10620
2023-03-14commands: Fix data race in testBjørn Erik Pedersen
Note that this is a test fix only.
2023-01-16Make hugo.toml the new config.tomlBjørn Erik Pedersen
Both will of course work, but hugo.toml will win if both are set. We should have done this a long time ago, of course, but the reason I'm picking this up now is that my VS Code setup by default picks up some JSON config schema from some random other software which also names its config files config.toml. Fixes #8979
2022-05-24basefs: add `noBuildLock` flagsatotake
If the flag is enabled, `.hugo_build.lock` will not be created. This ensures safe running on read-only filesystem etc. Close #9780
2022-05-09Revise the use of htime.Since/htime.NowBjørn Erik Pedersen
We cannot (also, it doesn't add any value) use that when the `clock` is set, * To measure time (before that global is set) * To compare file timestamps re cache eviction Fixes #9868
2022-05-08Use configured timeZone for the clockBjørn Erik Pedersen
And some other related adjustments. Updates #8787
2022-05-08Add `clock` cli flagsatotake
Close #8787
2022-04-08Rework the Destination filesystem to make --renderStaticToDisk workBjørn Erik Pedersen
See #9626
2022-03-25commands: Change link protocol to httpsJoe Mooring
2022-02-23Add support for CODEOWNERSMarshall Cottrell
Fixes #9474
2022-02-15Add --printUnusedTemplatesBjørn Erik Pedersen
Fixes #9502
2022-02-15commands: Rename --i18n-warnings to printI18nWarningsBjørn Erik Pedersen
To get it in line with the others.
2022-02-15commands: Rename --path-warnings, --print-men to --printPathWarnings, ↵Bjørn Erik Pedersen
--printMemoryUsage To get it in line with the others.
2022-02-10Remove the "check" commandJoe Mooring
Closes #9454
2022-01-06Add --panicOnWarning flagBjørn Erik Pedersen
Fixes #9357 Fixes #9359
2022-01-04Misc depreation updatesBjørn Erik Pedersen
* Deprecate .Page.Path when backed by a file * site.Permalinks * --ignoreVendor (use --ignoreVendorPaths) Closes #9348 Closes #9349
2021-08-31commands: Don't fail on template errors on go mod graph etc.Bjørn Erik Pedersen
Fixes #8942
2021-07-05commands: Move time notification to after any build errorsJohn Hollowell
This allows error parsers (VSCode problemMatchers) to use the time notification as bounds for detecting errors. Closes #8403
2021-07-05commands: Make the --poll flag a durationBjørn Erik Pedersen
So you can do: ``` hugo server --poll 700ms ``` See #8720
2021-07-04Add polling as a fallback to native filesystem events in server watchBjørn Erik Pedersen
Fixes #8720 Fixes #6849 Fixes #7930
2020-12-03all: Format code with gofumptBjørn Erik Pedersen
See https://github.com/mvdan/gofumpt
2020-10-22Allow getJSON errors to be ignoredBjørn Erik Pedersen
This change is mostly motivated to get a more stable CI build (we're building the Hugo site there, with Instagram and Twitter shortcodes sometimes failing). Fixes #7866
2020-09-10modules: Make ignoreVendor a glob patternBjørn Erik Pedersen
Fixes #7642
2020-06-25commands: Add an option to print memory usage at intervalsBjørn Erik Pedersen
Use it with `hugo --print-mem
2020-01-31commands: Fix config environment handlingBjørn Erik Pedersen
Fixes #6503 Fixes #6824
2019-11-25commands: Use HUGO_ENV if setBjørn Erik Pedersen
Fixes #6456
2019-11-21Add some more output if loading modules takes timeBjørn Erik Pedersen
Also include the time to collect modules etc. in the "Total in ..." time reported for the `hugo` command. Fixes #6519
2019-07-24Add Hugo ModulesBjørn Erik Pedersen
This commit implements Hugo Modules. This is a broad subject, but some keywords include: * A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project. * A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects. * Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running. * Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions. * A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`. All of the above is backed by Go Modules. Fixes #5973 Fixes #5996 Fixes #6010 Fixes #5911 Fixes #5940 Fixes #6074 Fixes #6082 Fixes #6092
2019-05-03Add a "deploy" commandRobert van Gent
2019-03-23Make Page an interfaceBjørn Erik Pedersen
The main motivation of this commit is to add a `page.Page` interface to replace the very file-oriented `hugolib.Page` struct. This is all a preparation step for issue #5074, "pages from other data sources". But this also fixes a set of annoying limitations, especially related to custom output formats, and shortcodes. Most notable changes: * The inner content of shortcodes using the `{{%` as the outer-most delimiter will now be sent to the content renderer, e.g. Blackfriday. This means that any markdown will partake in the global ToC and footnote context etc. * The Custom Output formats are now "fully virtualized". This removes many of the current limitations. * The taxonomy list type now has a reference to the `Page` object. This improves the taxonomy template `.Title` situation and make common template constructs much simpler. See #5074 Fixes #5763 Fixes #5758 Fixes #5090 Fixes #5204 Fixes #4695 Fixes #5607 Fixes #5707 Fixes #5719 Fixes #3113 Fixes #5706 Fixes #5767 Fixes #5723 Fixes #5769 Fixes #5770 Fixes #5771 Fixes #5759 Fixes #5776 Fixes #5777 Fixes #5778
2019-02-01Store supported config formats in a variableAnton Harniakou
2019-01-13Make hugo server -t work againAnton Harniakou
This commit solves an issue where hugo would ignore the cli -t flag and only use a theme defined in config.toml. Also allow -t flag to accept a string slice. Closes #5569 Closes #5061 Related #4868
2018-12-20commands: Remove the benchmark commandBjørn Erik Pedersen
It's not particulary useful, and when we start to get bug reports about it, it is easier to remove it. Closes #5543
2018-12-11Add /config dir supportBjørn Erik Pedersen
This commit adds support for a configuration directory (default `config`). The different pieces in this puzzle are: * A new `--environment` (or `-e`) flag. This can also be set with the `HUGO_ENVIRONMENT` OS environment variable. The value for `environment` defaults to `production` when running `hugo` and `development` when running `hugo server`. You can set it to any value you want (e.g. `hugo server -e "Sensible Environment"`), but as it is used to load configuration from the file system, the letter case may be important. You can get this value in your templates with `{{ hugo.Environment }}`. * A new `--configDir` flag (defaults to `config` below your project). This can also be set with `HUGO_CONFIGDIR` OS environment variable. If the `configDir` exists, the configuration files will be read and merged on top of each other from left to right; the right-most value will win on duplicates. Given the example tree below: If `environment` is `production`, the left-most `config.toml` would be the one directly below the project (this can now be omitted if you want), and then `_default/config.toml` and finally `production/config.toml`. And since these will be merged, you can just provide the environment specific configuration setting in you production config, e.g. `enableGitInfo = true`. The order within the directories will be lexical (`config.toml` and then `params.toml`). ```bash config ├── _default │   ├── config.toml │   ├── languages.toml │   ├── menus │   │   ├── menus.en.toml │   │   └── menus.zh.toml │   └── params.toml ├── development │   └── params.toml └── production ├── config.toml └── params.toml ``` Some configuration maps support the language code in the filename (e.g. `menus.en.toml`): `menus` (`menu` also works) and `params`. Also note that the only folders with "a meaning" in the above listing is the top level directories below `config`. The `menus` sub folder is just added for better organization. We use `TOML` in the example above, but Hugo also supports `JSON` and `YAML` as configuration formats. These can be mixed. Fixes #5422
2018-11-18Fix ignored --config flag with 'new' commandKris Budhram
2018-11-06commands: Fix spelling秦世成
2018-11-04commands: Add --minify to hugo serverBjørn Erik Pedersen
2018-10-16commands: Show server error info in browserBjørn Erik Pedersen
The main item in this commit is showing of errors with a file context when running `hugo server`. This can be turned off: `hugo server --disableBrowserError` (can also be set in `config.toml`). But to get there, the error handling in Hugo needed a revision. There are some items left TODO for commits soon to follow, most notable errors in content and config files. Fixes #5284 Fixes #5290 See #5325 See #5324
2018-09-21commands: Remove deprecated flagsBjørn Erik Pedersen
2018-08-06Add support for minification of final outputBjørn Erik Pedersen
Hugo Pipes added minification support for resources fetched via ´resources.Get` and similar. This also adds support for minification of the final output for supported output formats: HTML, XML, SVG, CSS, JavaScript, JSON. To enable, run Hugo with the `--minify` flag: ```bash hugo --minify ``` This commit is also a major spring cleaning of the `transform` package to allow the new minification step fit into that processing chain. Fixes #1251
2018-07-22Get rid of the utils packageBjørn Erik Pedersen
2018-06-10Add support for theme composition and inheritanceBjørn Erik Pedersen
This commit adds support for theme composition and inheritance in Hugo. With this, it helps thinking about a theme as a set of ordered components: ```toml theme = ["my-shortcodes", "base-theme", "hyde"] ``` The theme definition example above in `config.toml` creates a theme with the 3 components with presedence from left to right. So, Hugo will, for any given file, data entry etc., look first in the project, and then in `my-shortcode`, `base-theme` and lastly `hyde`. Hugo uses two different algorithms to merge the filesystems, depending on the file type: * For `i18n` and `data` files, Hugo merges deeply using the translation id and data key inside the files. * For `static`, `layouts` (templates) and `archetypes` files, these are merged on file level. So the left-most file will be chosen. The name used in the `theme` definition above must match a folder in `/your-site/themes`, e.g. `/your-site/themes/my-shortcodes`. There are plans to improve on this and get a URL scheme so this can be resolved automatically. Also note that a component that is part of a theme can have its own configuration file, e.g. `config.toml`. There are currently some restrictions to what a theme component can configure: * `params` (global and per language) * `menu` (global and per language) * `outputformats` and `mediatypes` The same rules apply here: The left-most param/menu etc. with the same ID will win. There are some hidden and experimental namespace support in the above, which we will work to improve in the future, but theme authors are encouraged to create their own namespaces to avoid naming conflicts. A final note: Themes/components can also have a `theme` definition in their `config.toml` and similar, which is the "inheritance" part of this commit's title. This is currently not supported by the Hugo theme site. We will have to wait for some "auto dependency" feature to be implemented for that to happen, but this can be a powerful feature if you want to create your own theme-variant based on others. Fixes #4460 Fixes #4450
2018-04-16commands: Re-add the missing releaser commandBjørn Erik Pedersen
2018-04-13commands: Fix handling of persistent CLI flagsBjørn Erik Pedersen
See #4607
2018-04-11commands: Make commands.Execute return a Response objectBjørn Erik Pedersen
We have no global `Hugo` object no more (yay!), and there are some external tools that depends on that value. These tools need to use get that value from `Response.Result`. Note that `commands.Execute` now also takes the arguments as a string slice. This should also make it easier to use, not having to modify `os.Args`. This commit also wraps up this particular issue. Phew! Test coverage in /commands before: 14.4% Now: 53.5% Still work to do, now it is at least possible. Closes #4598
2018-04-11commands: Remove some TODOsBjørn Erik Pedersen
See #4598
2018-04-11commands: Fix some flag diffBjørn Erik Pedersen
The CLI docs output is now identical with the master version. See #4598
2018-04-11commands: Move the commands related logic to its own fileBjørn Erik Pedersen
See #4598