Commit Graph

12 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee 64d190546d core: Always add a search path when `-c` is passed to the cli.
This way modular config load with just `-c` and don't require the
extra `-s`.
2021-09-22 19:17:02 -07:00
James Reed af7a6de1dc
Make 's' getopt flag take an argument 2020-09-17 03:27:35 -06:00
James Reed bcc7f62657
Fix missing getopt flags
Flags 'f' and 's' were added.
2020-09-16 14:27:14 -06:00
Emmanuel Lepage Vallée 46a9a7b970
modeline: Check the first XDG and fallback paths for modelines. (#3172)
This is not perfect. If the first config is invalid, then it wont use
the correct modeline. However there is no way to know if the config
is valid before attempting to execute it, so it's the best we can do.

Fix #3166
2020-09-14 11:02:09 -07:00
Emmanuel Lepage Vallee d0187055d8 init: Print a warning when non-ASCII encoding is used in a modeline. 2020-02-08 17:59:16 -05:00
Emmanuel Lepage Vallee 3a6af7bf6c doc: Document that `-s` is the alias for `--search`.
For some reason it wasn't.
2020-02-08 17:59:16 -05:00
Emmanuel Lepage Vallee d58b4c3d96 cmd: Add more info to --version.
Now that modeline are supported, they will affect the content of
version. This commits only adds the new information. `--version` has
to be the last command line argument and the modeline isn't parsed
yet.

Another commit will make sure --version parses the modeline and
finishes to process the command line arguments in case it isn't
last. Please note that luarocks also affects data points such as
the LGI version. It should be smarter and check if `rc.lua` has
`require("luarocks")`. This commit does *not* do it.
2020-02-08 17:18:01 -05:00
Emmanuel Lepage Vallee ee80fe052f init: Add an API level concept to `capi`.
The API level concept is something used by other projects such as
Android and iOS to allow deprecated features to be removed and the
bahavior to be altered without breaking compability with existing
code.

The same will apply to AwesomeWM. The current API level is "4" and
as long as config use this, no deprecation or bahavior change will
be exposed. If the user sets it to an higher value or we release
the next major version and new users start to use the, then current,
default config, they will use the new API level.

The the far future, if ever, we could fork the entire Lua libraries
to support legacy APIs. This would only require to keep the core
API support for those legacy calls. In the meantime, `gears.debug`
will use this to manage the deprecation and some conditional code
will be added as a last resort attempt to preserve behavior
compatibility while moving forward with breaking changes.
2020-02-08 17:18:01 -05:00
Emmanuel Lepage Vallee d2f8999595 init: Support loading awesome with shebang (#!) executables.
This commits re-use the modeline code from the previous commit
to support Lua scripts starting with #!. Previously, it was
non-trivial to add support since most *nix OS wont parse the
command line arguments correctly. Since we now have a state
machine good enough for 95%+ of the use case, it is easy to
support them.
2020-02-08 17:18:01 -05:00
Emmanuel Lepage Vallee f1aedb237a init: Add modeline support.
This commits adds the ability to add an `-- awesome_mode:` comment
to `rc.lua`. This line will be interpreted before Lua starts and
allow command line options to be set in the file.

There is also a partial shebang mode (`#!`) support. While it is
not yet possible to make a random Lua file executable and start
`awesome`, it is at least supported to configure AwesomeWM. The
next commit will add the missing bits.

This commit implements the parsing using a state machine. While
glib has its own functions, they don't do 100% of what we need.
It could have been possible to use them anyway and get quotes,
escaping and UTF-8 support for free. The downside would have been
duplicated code to handle shebangs and modeline. The state machine
code fully support 3 different ways of loading the arguments with
the same code path.
2020-02-08 17:17:59 -05:00
Emmanuel Lepage Vallee c616400239 cmd: Add an option to force the command line arguments.
The next commit will add modeline support. By default, modelines have
the final work on which options to set. However, mostly for testing,
this isn't flexible enough.
2020-02-08 17:12:56 -05:00
Emmanuel Lepage Vallee af4b4a254f init: Move the command option parsing to its own file.
The next commit will add modeline support and share the code.
2020-02-04 01:50:02 -05:00