Skip to content

DotfiM profiles #3

@Timoses

Description

@Timoses

Currently it's not possible to synchronize dotfile setups for specific environment types only. E.g. one would want a dotfile to exist and work for both a Windows and a Linux mashine. The ability to

  • assign specific lines of a file to a profile and
  • assign a file to a profile

enable the use of DotfiM for the purpose of

  • managing files for different types of environments (Windows/Linux),
  • using only dotfiles pertaining to a particular application and
  • adding passages/files only used in specific types of environments or situations (e.g. free time vs work environment)

Command overview

  • dotfim sync [--profile=<profile>] [<FilesOrFolders>]: allows syncing only specific profiles and/or files/folders
  • dotfim profile: list available profiles, and e.g. mark synced ones with *, OR: list available commands only
    • ls list profiles, like above
    • add a profile to be synced on this machine
    • remove profile from this machine's synced profile list
  • dotfim add --profile=<profile>[,<profiles>] <dotfile>: Add a specific file to one or more profiles
    • have to check that the file does not contain # dotfim profile <...> control statements!!!

Implications

  • The ability to add specific files to profiles requires to either
    • store that info in the file itself (profile header/file name, see below)
    • or store the information in a shared/synced dotfim config file
    • Implementing both could mean a bit more resilience and user friendly design
  • If no profile is specified the default profile is used. this allows a user to opt-out of the default profile and only sync specific profiles.

Control comments in dotfiles

# dotfim profile <profile1>,<profile2>,...: only applied to dotfile if the machine's dotfim is set up to be synced with the profile dotfim profile add...

  • A dotfile may not contain (see below "however simply") a profile passage for a specific when that is not currently synced (user first has to use dotfim profile add <profile> && dotfim sync --profile <profile>) before allowing the addition of further passages
    • Otherwise, the order in which the new dotfile profile passage should be added is unclear
      • !!!!!! Could however simply add the new profile passage to the bottom of the last gitfile profile passage. OR!!!! use the existing other lines as a reference of where the dotfile passage should be inserted!

Further ideas

  • Track which machine/hostname & user uses which profiles (could be stored in gitfile with #managed by dotfim): allows listing which hosts use which profiles
  • A file could be assigned to one or more profiles (dotfim add --profile). This means either
    • the file name could be used for distinctaion (e.g. .vimrc.profile_<name1>), or
    • the file contains several sections with headers and splitters (use old sectionHandler?....)

TODO

Add the following ideas:

Several Profiles Can be Assigned to a Passage.
Allows e.g. creating a 'remote' profile. The same passages can be used in other profiles as well.
What about: if I want a passage profiled 'bash' to have a 'remote' and a 'normal' version? -> Add combination of passages? E.g. <'bash','normal'> and <'bash','remote'>?

profiles are like passages, but they may contain passages. E.g. a gitfile would have:

# dotfim profile windows {
# dotfim local windows-machine
...
# dotfim }

# dotfim profile linux
linux profile line

In effect it works like "local/private" (which filters the host name).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions